This commit is contained in:
2024-08-22 15:47:37 +08:00
parent bdb96e61a1
commit 1be37ab104
11 changed files with 453 additions and 112 deletions

View File

@@ -12,7 +12,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "守护",
"info": "自身护盾",
"atktype": "攻击型",
@@ -30,7 +32,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "狂暴",
"info": "全体攻击",
"atktype": "攻击型",
@@ -48,7 +52,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "火焰",
"info": "大火球",
"atktype": "攻击型",
@@ -66,7 +72,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "狗"
},
@@ -82,7 +90,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "蚂蚁"
},
@@ -98,7 +108,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "蚂蚁"
},
@@ -114,7 +126,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "金刚",
"info": "全体招架",
"atktype": "攻击型",
@@ -132,7 +146,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "狂暴",
"info": "全体攻击",
"atktype": "攻击型",
@@ -150,7 +166,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "鹰"
},
@@ -166,7 +184,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "鹰"
},
@@ -182,7 +202,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "鹰"
},
@@ -198,7 +220,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "火焰",
"info": "大火球",
"atktype": "攻击型",
@@ -216,7 +240,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "守护",
"info": "全体护盾",
"atktype": "攻击型",
@@ -234,7 +260,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "山羊"
},
@@ -250,7 +278,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "山羊"
},
@@ -266,7 +296,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "炎爆",
"info": "炎爆",
"atktype": "攻击型",
@@ -284,7 +316,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "金刚",
"info": "全体招架",
"atktype": "攻击型",
@@ -302,7 +336,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "鹿"
},
@@ -318,7 +354,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻击型",
"mon": "鹿"
},
@@ -334,7 +372,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "守护",
"info": "自身护盾",
"atktype": "血量型",
@@ -352,7 +392,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "再生",
"info": "全体回血",
"atktype": "血量型",
@@ -370,7 +412,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"info": "全体护盾",
"atktype": "血量型",
"mon": "绵羊"
@@ -387,7 +431,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "血量型",
"mon": "绵羊"
},
@@ -403,7 +449,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "血量型",
"mon": "绵羊"
},
@@ -419,7 +467,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "坚韧",
"info": "全体护盾",
"atktype": "血量型",
@@ -437,7 +487,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "狂暴",
"info": "全体攻击",
"atktype": "血量型",
@@ -455,7 +507,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "血量型",
"mon": "龟"
},
@@ -471,7 +525,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "血量型",
"mon": "龟"
},
@@ -487,7 +543,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "风刃",
"info": "风刃",
"atktype": "血量型",
@@ -505,7 +563,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "急速",
"info": "全体闪避",
"atktype": "血量型",
@@ -523,7 +583,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "血量型",
"mon": "野猪"
},
@@ -539,7 +601,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "血量型",
"mon": "野猪"
},
@@ -555,7 +619,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "血量型",
"mon": "野猪"
},
@@ -571,7 +637,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "坚韧",
"info": "全体护盾",
"atktype": "血量型",
@@ -589,7 +657,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "雷暴",
"info": "雷暴",
"atktype": "血量型",
@@ -607,7 +677,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "血量型",
"mon": "犀牛"
},
@@ -623,7 +695,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "血量型",
"mon": "犀牛"
},
@@ -639,7 +713,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "守护",
"info": "自身护盾",
"atktype": "攻速型",
@@ -657,7 +733,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "急速",
"info": "全体闪避",
"atktype": "攻速型",
@@ -675,7 +753,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "狂暴",
"info": "全体攻击",
"atktype": "攻速型",
@@ -692,7 +772,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻速型",
"mon": "鼠"
},
@@ -708,7 +790,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "狂爆",
"info": "全体攻击",
"atktype": "攻速型",
@@ -726,7 +810,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "急速",
"info": "全体闪避",
"atktype": "攻速型",
@@ -743,7 +829,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻速型",
"mon": "山猫"
},
@@ -758,7 +846,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻速型",
"mon": "机械蜜蜂"
},
@@ -773,7 +863,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻速型",
"mon": "机械山猫"
},
@@ -789,7 +881,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "坚韧",
"info": "全体护盾",
"atktype": "攻速型",
@@ -807,7 +901,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "冰封",
"info": "冰封",
"atktype": "攻速型",
@@ -824,7 +920,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻速型",
"mon": "狮子"
},
@@ -839,7 +937,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻速型",
"mon": "狮子"
},
@@ -855,7 +955,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "急速",
"info": "全体闪避",
"atktype": "攻速型",
@@ -873,7 +975,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"word": "潮汐",
"info": "潮汐",
"atktype": "攻速型",
@@ -890,7 +994,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻速型",
"mon": "独角兽"
},
@@ -905,7 +1011,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "攻速型",
"mon": "独角兽"
},
@@ -920,7 +1028,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "精英型",
"mon": "雷电犀牛"
},
@@ -935,7 +1045,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "精英型",
"mon": "闪电鼠"
},
@@ -950,7 +1062,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "精英型",
"mon": "龙"
},
@@ -965,7 +1079,9 @@
"power": 50,
"speed": 80,
"skill": "base",
"skill_uuid":9001,
"max_skill": "base",
"max_skill_uuid":1001,
"atktype": "精英型",
"mon": "龙"
}

View File

@@ -38,34 +38,34 @@
},
{
"__id__": 75
},
{
"__id__": 79
}
],
"_active": true,
"_components": [
{
"__id__": 79
},
{
"__id__": 81
},
{
"__id__": 83
},
{
"__id__": 85
},
{
"__id__": 87
},
{
"__id__": 89
},
{
"__id__": 91
},
{
"__id__": 93
},
{
"__id__": 95
},
{
"__id__": 88
},
{
"__id__": 97
},
{
"__id__": 99
}
],
"_prefab": {
"__id__": 93
"__id__": 101
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -1807,6 +1807,217 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "rang_box",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 80
},
{
"__id__": 82
},
{
"__id__": 84
},
{
"__id__": 86
}
],
"_prefab": {
"__id__": 90
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -7.143,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 79
},
"_enabled": true,
"__prefab": {
"__id__": 81
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a7v65R9FlK35rDSodMKBaf"
},
{
"__type__": "cc.RigidBody2D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 79
},
"_enabled": true,
"__prefab": {
"__id__": 83
},
"enabledContactListener": true,
"bullet": true,
"awakeOnLoad": true,
"_group": 1,
"_type": 1,
"_allowSleep": false,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "1dGvLlJTxIyqWs7tv5eOjk"
},
{
"__type__": "cc.BoxCollider2D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 79
},
"_enabled": true,
"__prefab": {
"__id__": 85
},
"tag": 0,
"_group": 1,
"_density": 1,
"_sensor": true,
"_friction": 0.2,
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 45
},
"_size": {
"__type__": "cc.Size",
"width": 200,
"height": 80
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c1dqgNlJdOJJzLITAnZIRf"
},
{
"__type__": "330a4VcViNGVIep43vzoib3",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 79
},
"_enabled": true,
"__prefab": {
"__id__": 87
},
"Hero_node": {
"__id__": 88
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "64UkfVY1dKB79n553D1pj7"
},
{
"__type__": "dc1b7IQTVxHfIHFfWu0u4I/",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 89
},
"hitFlashMaterial": {
"__uuid__": "a8f34051-ccff-4050-b9d9-234f62977264",
"__expectedType__": "cc.Material"
},
"BoxRang": {
"__id__": 86
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "88a6VdbQBB7YwXovYCN2Sy"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "efBGnhxpVAs6aCGcg6inWm",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -1817,7 +2028,7 @@
},
"_enabled": false,
"__prefab": {
"__id__": 80
"__id__": 92
},
"_contentSize": {
"__type__": "cc.Size",
@@ -1845,7 +2056,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 82
"__id__": 94
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@@ -1887,7 +2098,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 84
"__id__": 96
},
"animator": {
"__id__": 24
@@ -1898,28 +2109,6 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "6cDIo6gXFNnbPNuWVAqhBD"
},
{
"__type__": "dc1b7IQTVxHfIHFfWu0u4I/",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 86
},
"hitFlashMaterial": {
"__uuid__": "a8f34051-ccff-4050-b9d9-234f62977264",
"__expectedType__": "cc.Material"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "88a6VdbQBB7YwXovYCN2Sy"
},
{
"__type__": "cc.RigidBody2D",
"_name": "",
@@ -1930,7 +2119,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 88
"__id__": 98
},
"enabledContactListener": true,
"bullet": true,
@@ -1964,7 +2153,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 90
"__id__": 100
},
"tag": 0,
"_group": 2,
@@ -1988,40 +2177,6 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "b2Dt9lJI9FyJCDezkDBPBl"
},
{
"__type__": "cc.BoxCollider2D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 92
},
"tag": 4,
"_group": 4,
"_density": 1,
"_sensor": true,
"_friction": 0.2,
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0.6,
"y": 34.9
},
"_size": {
"__type__": "cc.Size",
"width": 152.8,
"height": 69.9
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "1d3plX+d1OE42XB2BpU876"
},
{
"__type__": "cc.PrefabInfo",
"root": {

View File

@@ -95,6 +95,8 @@ export const SkillSet={
4040:{uuid: 4010,path: "1010",type: 1,level: 4,name: "治愈-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4011:{uuid: 4011,path: "1011",type: 1,level: 6,name: "火焰风暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4012:{uuid: 4012,path: "1012",type: 1,level: 6,name: "冰晶风暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
9001:{uuid: 9001,path: "9001",type: 1,level: 1,name: "基础攻击1",sp_name:"base",dis:90,count:1,atk: 4,sd:10,cd:1,speed:400,},
9002:{uuid: 9001,path: "9001",type: 1,level: 1,name: "基础攻击2",sp_name:"base2",dis:90,count:1,atk: 4,sd:10,cd:1,speed:400,},
}

View File

@@ -49,7 +49,7 @@ export class MapMonsterComp extends CCComp {
this.monster_refresh()
}
if (this.refresh_timer.update(dt)) {
// this.setp_num = RandomManager.instance.getRandomInt(this.min_monster_num,this.max_monster_num,2)
this.setp_num = RandomManager.instance.getRandomInt(this.min_monster_num,this.max_monster_num,2)
}
if (this.mission_up_timer.update(dt)) {
// 刷新怪物定时器

View File

@@ -0,0 +1,51 @@
import { _decorator,Contact2DType,Collider2D ,IPhysics2DContact} from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { BoxSet } from "../common/config/BoxSet";
import { MonsterViewComp } from "./MonsterViewComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('BoxRangComp')
@ecs.register('BoxRang', false)
export class BoxRangComp extends CCComp {
@property(MonsterViewComp)
Hero_node:MonsterViewComp = null!;
box_group:number = BoxSet.DEFAULT;
box_tag:number = BoxSet.ATK_RANGE;
/** 视图层逻辑代码分离演示 */
start() {
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
collider.tag = this.box_tag;
// console.log(collider,this.Hero_node);
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
}
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
}
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
}
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE){
this.Hero_node.is_atking = true;
}
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "330a455c-5623-4654-87a9-e37bf3a226f7",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -16,6 +16,7 @@ import { MonsterSpine } from "./MonsterSpine";
import { MonsterViewComp } from "./MonsterViewComp";
import {HeroModelComp} from "./HeroModelComp";
import { CardSet } from "../common/config/CardSet";
import { BoxSet } from "../common/config/BoxSet";
/** 角色实体 */
@ecs.register(`Hero`)
export class Hero extends ecs.Entity {
@@ -63,12 +64,15 @@ export class Hero extends ecs.Entity {
mv.hero_uuid=uuid;
mv.speed =mv.ospeed = smc.heros[uuid].speed;
mv.hero_name= smc.heros[uuid].name;
mv.box_group= BoxSet.HERO;
mv.hp= mv.hp_max = smc.heros[uuid].hp;
mv.level = smc.heros[uuid].level;
mv.atk = smc.heros[uuid].atk;
mv.atk_cd = smc.heros[uuid].atk_cd;
mv.power = smc.heros[uuid].power;
mv.type = smc.heros[uuid].type;
mv.skill_uuid = 9001;
mv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
mv.Tpos = v3(0,0,0);
mv.scale = 1;
mv.change_name(smc.heros[uuid].name,1)

View File

@@ -15,6 +15,7 @@ import { MonsterModelComp } from "./MonsterModelComp";
import { MonsterSpine } from "./MonsterSpine";
import { MonsterViewComp } from "./MonsterViewComp";
import { CardSet } from "../common/config/CardSet";
import { BoxSet } from "../common/config/BoxSet";
/** 角色实体 */
@ecs.register(`Monster`)
export class Monster extends ecs.Entity {
@@ -61,14 +62,15 @@ export class Monster extends ecs.Entity {
var mv = node.getComponent(MonsterViewComp)!;
mv.speed =mv.ospeed = smc.heros[uuid].speed;
mv.hero_name= smc.heros[uuid].name;
mv.box_group= BoxSet.MONSTER;
mv.hp= mv.hp_max = smc.heros[uuid].hp;
mv.level = smc.heros[uuid].level;
mv.atk = smc.heros[uuid].atk;
mv.atk_cd = smc.heros[uuid].atk_cd;
mv.power = smc.heros[uuid].power;
mv.type = smc.heros[uuid].type;
mv.skill_name = "base2";
mv.max_skill_name = "fire";
mv.skill_uuid = 9002;
mv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
mv.scale = -1;
mv.Tpos = v3(0,0,0);
mv.change_name(smc.heros[uuid].name,-1)

View File

@@ -18,6 +18,8 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
import { Skill } from "../skills/Skill";
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { SkillCom } from "../skills/SkillCom";
import { SkillSet } from "../common/config/CardSet";
import { BoxRangComp } from "./BoxRangComp";
const { ccclass, property } = _decorator;
/** 角色显示组件 */
@@ -29,7 +31,8 @@ export class MonsterViewComp extends CCComp {
hitFlashMaterial: Material;
orginalFlashMaterial: Material;
sprite: Sprite;
@property(BoxRangComp)
BoxRang:BoxRangComp = null!;
/** 角色动画 */
as: MonsterSpine = null!;
hero_uuid:number = 1001;
@@ -49,7 +52,8 @@ export class MonsterViewComp extends CCComp {
skill_name: string = "base"; //技能名称
max_skill_name: string = "base"; //大技能名称
skill_uuid:number = 9001;
max_skill_uuid:number = 1001;
atk: number = 10; /**攻击力 */
// atk_speed: number = 1;
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
@@ -63,6 +67,7 @@ export class MonsterViewComp extends CCComp {
shield:number = 0; //护盾量
shield_time:number = 0; //护盾持续时间
box_group:number = 2;
private timer:Timer = new Timer(0.1); //计时器
is_dead:boolean = false; //是否摧毁
@@ -79,10 +84,13 @@ export class MonsterViewComp extends CCComp {
} /** 视图层逻辑代码分离演示 */
start () {
this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
// 注册单个碰撞体的回调函数
let collider = this.getComponent(Collider2D);
console.log(collider);
collider.group = this.box_group;
this.BoxRang.box_group = this.box_group;
// console.log(collider);
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
@@ -108,13 +116,11 @@ export class MonsterViewComp extends CCComp {
}
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE){
this.is_atking = true;
if(otherCollider.tag != BoxSet.SKILL_TAG&&selfCollider.tag != BoxSet.ATK_RANGE){
this.stop_cd = 0.1;
}
}
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE){
this.is_atking = true;
}
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
@@ -189,7 +195,6 @@ export class MonsterViewComp extends CCComp {
if ((this.scale === 1 && this.node.position.x >= 120) || (this.scale !== 1 && this.node.position.x <= -180)) {
return;
}
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y, this.node.position.z);
}
get_monster_pos(){
@@ -198,12 +203,24 @@ export class MonsterViewComp extends CCComp {
power_change(power: number){
this.power += power;
if(this.power >= this.power_max){
this.shoot(this.max_skill_name);
this.shoot(this.max_skill_uuid);
this.power = 0
}
let power_progress= this.power/this.power_max;
this.node.getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
}
shoot(skill_uuid:number){
console.log("monster shoot");
let skill = ecs.getEntity<Skill>(Skill);
let x=0
let pos = v3(x,40)
let speed =SkillSet[skill_uuid].speed;
let scale = this.scale
let dis = SkillSet[skill_uuid].dis;
let atk = SkillSet[skill_uuid].atk+this.atk;
let sp_name = SkillSet[skill_uuid].sp_name;
skill.load(pos,speed,dis,scale,this.node,sp_name,atk);
}
in_act(dt: number) {
if(this.atk_time >= this.atk_cd){
@@ -212,7 +229,7 @@ export class MonsterViewComp extends CCComp {
// console.log("atk_cd:"+this.atk_cd);
this.as.atk();
this.scheduleOnce(()=>{
this.shoot(this.skill_name);
this.shoot(this.skill_uuid);
},0.2)
}
}else{
@@ -269,22 +286,7 @@ export class MonsterViewComp extends CCComp {
}
});
}
shoot(skill_name:string){
console.log("monster shoot");
let skill = ecs.getEntity<Skill>(Skill);
let x=30
if(this.scale==1){
x=0
}else{
x=-0
}
let pos = v3(x,40)
let speed =350
let scale = this.scale
let dis = 50;
console.log(speed);
skill.load(pos,speed,dis,scale,this.node,skill_name,this.atk);
}
in_atked() {
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
this.scheduleOnce(() => {

View File

@@ -28,15 +28,14 @@ export class Skill extends ecs.Entity {
this.remove(SkillCom);
super.destroy();
}
load(pos: Vec3 = Vec3.ZERO,speed:number = 100,dis:number = 50,scale:number = 1,parent:Node,skill_name:string = "base",atk:number =10,angle = 0,t_pos:Vec3 = null) {
var path = "game/skills/"+skill_name;
load(pos: Vec3 = Vec3.ZERO,speed:number = 100,dis:number = 50,scale:number = 1,parent:Node,sp_name:string = "base",atk:number =10,angle = 0,t_pos:Vec3 = null) {
var path = "game/skills/"+sp_name;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = parent;
node.setScale(scale,1)
//转换pos为世界坐标
node.setPosition(pos)
console.log(speed)
var sv = node.getComponent(SkillCom)!;
sv.speed = speed;
sv.dis = dis;

View File

@@ -32,6 +32,7 @@ export class SkillCom extends CCComp {
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
// console.log("skill group",this.box_group)
collider.tag = this.box_tag;
collider.sensor = true;
if (collider) {
@@ -62,7 +63,7 @@ export class SkillCom extends CCComp {
}
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(otherCollider.group != selfCollider.group){
console.log("skill end contact")
// console.log("skill end contact",selfCollider.group,otherCollider.group)
setTimeout(() => {
this.toDestroy()
}, 10);