Explorar o código

修改黑暗法师技能

lanyunfei hai 2 días
pai
achega
2308aecd4c

+ 274 - 0
assets/game/animation/guihun.anim

@@ -0,0 +1,274 @@
+{
+  "__type__": "cc.AnimationClip",
+  "_name": "guihun",
+  "_objFlags": 0,
+  "_native": "",
+  "_duration": 2.1333333333333333,
+  "sample": 15,
+  "speed": 1,
+  "wrapMode": 2,
+  "curveData": {
+    "comps": {
+      "cc.Sprite": {
+        "spriteFrame": [
+          {
+            "frame": 0,
+            "value": {
+              "__uuid__": "c735f379-8456-451c-b438-22db5b8bbdf1"
+            }
+          },
+          {
+            "frame": 0.06666666666666667,
+            "value": {
+              "__uuid__": "c49d57df-9036-4764-8969-ef1d30e8cd63"
+            }
+          },
+          {
+            "frame": 0.13333333333333333,
+            "value": {
+              "__uuid__": "d6e177eb-a85f-468d-af2a-1b83e761ec62"
+            }
+          },
+          {
+            "frame": 0.2,
+            "value": {
+              "__uuid__": "b8fc7786-9414-47e5-8f64-7127c6480979"
+            }
+          },
+          {
+            "frame": 0.26666666666666666,
+            "value": {
+              "__uuid__": "c735f379-8456-451c-b438-22db5b8bbdf1"
+            }
+          },
+          {
+            "frame": 0.3333333333333333,
+            "value": {
+              "__uuid__": "c49d57df-9036-4764-8969-ef1d30e8cd63"
+            }
+          },
+          {
+            "frame": 0.4,
+            "value": {
+              "__uuid__": "d6e177eb-a85f-468d-af2a-1b83e761ec62"
+            }
+          },
+          {
+            "frame": 0.4666666666666667,
+            "value": {
+              "__uuid__": "b8fc7786-9414-47e5-8f64-7127c6480979"
+            }
+          },
+          {
+            "frame": 0.5333333333333333,
+            "value": {
+              "__uuid__": "c735f379-8456-451c-b438-22db5b8bbdf1"
+            }
+          },
+          {
+            "frame": 0.6,
+            "value": {
+              "__uuid__": "c49d57df-9036-4764-8969-ef1d30e8cd63"
+            }
+          },
+          {
+            "frame": 0.6666666666666666,
+            "value": {
+              "__uuid__": "d6e177eb-a85f-468d-af2a-1b83e761ec62"
+            }
+          },
+          {
+            "frame": 0.7333333333333333,
+            "value": {
+              "__uuid__": "b8fc7786-9414-47e5-8f64-7127c6480979"
+            }
+          },
+          {
+            "frame": 0.8,
+            "value": {
+              "__uuid__": "c735f379-8456-451c-b438-22db5b8bbdf1"
+            }
+          },
+          {
+            "frame": 0.8666666666666667,
+            "value": {
+              "__uuid__": "c49d57df-9036-4764-8969-ef1d30e8cd63"
+            }
+          },
+          {
+            "frame": 0.9333333333333333,
+            "value": {
+              "__uuid__": "d6e177eb-a85f-468d-af2a-1b83e761ec62"
+            }
+          },
+          {
+            "frame": 1,
+            "value": {
+              "__uuid__": "b8fc7786-9414-47e5-8f64-7127c6480979"
+            }
+          },
+          {
+            "frame": 1.0666666666666667,
+            "value": {
+              "__uuid__": "c735f379-8456-451c-b438-22db5b8bbdf1"
+            }
+          },
+          {
+            "frame": 1.1333333333333333,
+            "value": {
+              "__uuid__": "c49d57df-9036-4764-8969-ef1d30e8cd63"
+            }
+          },
+          {
+            "frame": 1.2,
+            "value": {
+              "__uuid__": "d6e177eb-a85f-468d-af2a-1b83e761ec62"
+            }
+          },
+          {
+            "frame": 1.2666666666666666,
+            "value": {
+              "__uuid__": "b8fc7786-9414-47e5-8f64-7127c6480979"
+            }
+          },
+          {
+            "frame": 1.3333333333333333,
+            "value": {
+              "__uuid__": "c735f379-8456-451c-b438-22db5b8bbdf1"
+            }
+          },
+          {
+            "frame": 1.4,
+            "value": {
+              "__uuid__": "c49d57df-9036-4764-8969-ef1d30e8cd63"
+            }
+          },
+          {
+            "frame": 1.4666666666666666,
+            "value": {
+              "__uuid__": "d6e177eb-a85f-468d-af2a-1b83e761ec62"
+            }
+          },
+          {
+            "frame": 1.5333333333333334,
+            "value": {
+              "__uuid__": "b8fc7786-9414-47e5-8f64-7127c6480979"
+            }
+          },
+          {
+            "frame": 1.6,
+            "value": {
+              "__uuid__": "c735f379-8456-451c-b438-22db5b8bbdf1"
+            }
+          },
+          {
+            "frame": 1.6666666666666667,
+            "value": {
+              "__uuid__": "c49d57df-9036-4764-8969-ef1d30e8cd63"
+            }
+          },
+          {
+            "frame": 1.7333333333333334,
+            "value": {
+              "__uuid__": "d6e177eb-a85f-468d-af2a-1b83e761ec62"
+            }
+          },
+          {
+            "frame": 1.8,
+            "value": {
+              "__uuid__": "b8fc7786-9414-47e5-8f64-7127c6480979"
+            }
+          },
+          {
+            "frame": 1.8666666666666667,
+            "value": {
+              "__uuid__": "c735f379-8456-451c-b438-22db5b8bbdf1"
+            }
+          },
+          {
+            "frame": 1.9333333333333333,
+            "value": {
+              "__uuid__": "c49d57df-9036-4764-8969-ef1d30e8cd63"
+            }
+          },
+          {
+            "frame": 2,
+            "value": {
+              "__uuid__": "d6e177eb-a85f-468d-af2a-1b83e761ec62"
+            }
+          },
+          {
+            "frame": 2.066666666666667,
+            "value": {
+              "__uuid__": "b8fc7786-9414-47e5-8f64-7127c6480979"
+            }
+          }
+        ]
+      }
+    },
+    "props": {
+      "scale": [
+        {
+          "frame": 0,
+          "value": {
+            "__type__": "cc.Vec3",
+            "x": 1,
+            "y": 0.8,
+            "z": 1
+          }
+        },
+        {
+          "frame": 0.5333333333333333,
+          "value": {
+            "__type__": "cc.Vec3",
+            "x": 1,
+            "y": 1,
+            "z": 1
+          }
+        },
+        {
+          "frame": 1,
+          "value": {
+            "__type__": "cc.Vec3",
+            "x": 1,
+            "y": 0.8,
+            "z": 1
+          }
+        },
+        {
+          "frame": 1.5333333333333334,
+          "value": {
+            "__type__": "cc.Vec3",
+            "x": 1,
+            "y": 1,
+            "z": 1
+          }
+        },
+        {
+          "frame": 2.066666666666667,
+          "value": {
+            "__type__": "cc.Vec3",
+            "x": 1,
+            "y": 0.8,
+            "z": 1
+          }
+        }
+      ],
+      "opacity": [
+        {
+          "frame": 0,
+          "value": 125
+        },
+        {
+          "frame": 1,
+          "value": 50
+        },
+        {
+          "frame": 2.066666666666667,
+          "value": 125
+        }
+      ]
+    }
+  },
+  "events": []
+}

+ 6 - 0
assets/game/animation/guihun.anim.meta

@@ -0,0 +1,6 @@
+{
+  "ver": "2.1.2",
+  "uuid": "b6340db3-dc7f-477b-b879-6d10cf0be535",
+  "importer": "animation-clip",
+  "subMetas": {}
+}

+ 241 - 6
assets/game/prefab/bullet.prefab

@@ -16,21 +16,31 @@
     "_name": "bullet",
     "_objFlags": 0,
     "_parent": null,
-    "_children": [],
+    "_children": [
+      {
+        "__id__": 2
+      },
+      {
+        "__id__": 5
+      }
+    ],
     "_active": true,
     "_components": [
       {
-        "__id__": 2
+        "__id__": 8
       },
       {
-        "__id__": 4
+        "__id__": 10
       },
       {
-        "__id__": 5
+        "__id__": 11
+      },
+      {
+        "__id__": 12
       }
     ],
     "_prefab": {
-      "__id__": 6
+      "__id__": 13
     },
     "_opacity": 255,
     "_color": {
@@ -80,6 +90,216 @@
     "_id": ""
   },
   {
+    "__type__": "cc.Node",
+    "_name": "tex1",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 3
+      }
+    ],
+    "_prefab": {
+      "__id__": 4
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": null,
+    "_type": 0,
+    "_sizeMode": 1,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "38erVnM55LNoVqNA35oXWY",
+    "sync": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "tex2",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 6
+      }
+    ],
+    "_prefab": {
+      "__id__": 7
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 5
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": null,
+    "_type": 0,
+    "_sizeMode": 1,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "96KagBDA5DirUi45XMqM73",
+    "sync": false
+  },
+  {
     "__type__": "60f21sQlalGUIOu/1UiFxwE",
     "_name": "",
     "_objFlags": 0,
@@ -91,7 +311,7 @@
     "spriteAtlas": null,
     "frameConfigs": [
       {
-        "__id__": 3
+        "__id__": 9
       }
     ],
     "playOnLoad": false,
@@ -145,6 +365,21 @@
     "_id": ""
   },
   {
+    "__type__": "cc.Animation",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "_defaultClip": null,
+    "_clips": [
+      null
+    ],
+    "playOnLoad": false,
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1

+ 2 - 0
assets/script/ECS/components/ComSkillAbel.ts

@@ -21,6 +21,8 @@ export class ComSkillAbel {
     skillBulletPos: cc.Vec2
     //多段子弹时间
     skillBulletTime: number
+    //多段子弹创建数量
+    skillBulletNum: number
     //群体技能施放位置
     skillPos: cc.Vec2
     //特效ID

+ 12 - 1
assets/script/ECS/core/BulletEventProcess.ts

@@ -2,6 +2,8 @@
 import FrameAnimation from '../../uiutils/FrameAnimation'
 import {IBulletConfig} from '../../config/BulletConfig'
 import {EventProcess} from './EventProcess'
+import {ANI_TYPE} from '../../enums/Enum'
+import {FrameAniConfig} from '../../config/FrameAniConfig'
 
 const {ccclass, property} = cc._decorator
 
@@ -12,7 +14,16 @@ export class BulletEventProcess extends EventProcess {
     onAttach(): void {
         this.frameAnimation = this.getComponent(FrameAnimation)
         if (this.bulletConfig.ani) {
-            this.playFrameAni(`texture/bullet/${this.bulletConfig.ani}`, true)
+            if (FrameAniConfig[this.bulletConfig.ani]) {
+                let aniConfig = FrameAniConfig[this.bulletConfig.ani]
+                if (aniConfig.type == ANI_TYPE.frameAni) {
+                    this.playFrameAni(`texture/bullet/${this.bulletConfig.ani}`, true)
+                } else if (aniConfig.type == ANI_TYPE.action) {
+                    this.playAnimation(`animation/${aniConfig.url}`)
+                }
+            } else {
+                this.playFrameAni(`texture/bullet/${this.bulletConfig.ani}`, true)
+            }
         } else if (this.bulletConfig.url) {
             this.world.gameUI.loadGameImg(`texture/bullet/${this.bulletConfig.url}`, this.node)
         }

+ 1 - 0
assets/script/ECS/systems/SysCocosView.ts

@@ -246,6 +246,7 @@ export class SysCocosView extends ECSSystem implements ITouchProcessor {
             comSkillAbel.startDirty = false
             comSkillAbel.castSkillTime = 0
             comSkillAbel.skillBulletTime = 0
+            comSkillAbel.skillBulletNum = 0
             comSkillAbel.skillConfig = null
             comSkillAbel.roles.length = 0
             // 此处必须让所有的cObject位置更新

+ 50 - 58
assets/script/ECS/systems/SysSkillAbel.ts

@@ -88,17 +88,45 @@ export class SysSkillAbel extends ECSSystem {
                         if (comSkillAbel.skillConfig.hitID) {
                             world.createAni(comSkillAbel.skillConfig.hitID, undefined, comSkillAbel.skillBulletPos)
                         }
+                    } else {
+                        //让技能可以重新被施放
+                        let curSkillIndex = comRole.skills.findIndex(value => value.ID == comSkillAbel.skillConfig.ID)
+                        if (curSkillIndex >= 0) {
+                            comRole.skillCountDowns[curSkillIndex] = comRole.castTime[curSkillIndex]
+                        }
                     }
-                } else if (comSkillAbel.skillConfig.type == SKILL_TYPE.ejectionSkillBullet) {
-                    comSkillAbel.bullets = []
-                    let cfg =
-                        comSkillAbel.skillConfig.effectParm[
-                            comSkillAbel.skillConfig.effectType.indexOf(SKILL_EFFECT_TYPE.skillBullet)
-                        ]
-                    let bulletNum = cfg[1]
-                    for (let i = 0; i < bulletNum; i++) {
+                }
+                comSkillAbel.bullets = []
+                comSkillAbel.skillBulletTime = this.getSkillBulletInverter(comSkillAbel)
+                comSkillAbel.skillBulletNum = 0
+                comSkillAbel.startDirty = false
+            }
+            //发射多枚技能子弹
+            if (
+                comSkillAbel.skillConfig.type == SKILL_TYPE.skillBullet ||
+                comSkillAbel.skillConfig.type == SKILL_TYPE.ejectionSkillBullet
+            ) {
+                let skillBulletParams =
+                    comSkillAbel.skillConfig.effectParm[
+                        comSkillAbel.skillConfig.effectType.indexOf(SKILL_EFFECT_TYPE.skillBullet)
+                    ]
+                let bulletNum = skillBulletParams[1]
+                comSkillAbel.skillBulletTime -= dt
+                if (comSkillAbel.skillBulletTime <= 0 && comSkillAbel.skillBulletNum < bulletNum) {
+                    comSkillAbel.skillBulletNum += 1
+                    //0是吟唱时间平均值
+                    comSkillAbel.skillBulletTime = this.getSkillBulletInverter(comSkillAbel)
+                    if (comSkillAbel.skillConfig.type == SKILL_TYPE.skillBullet) {
+                        world.createRoleSkillBulletEntity(
+                            skillBulletParams[0],
+                            entity,
+                            BulletConfig[skillBulletParams[0]]?.type == BULLET_TYPE.normal ? comSkillAbel.roles[0] : 0,
+                            Boolean(skillBulletParams[3]),
+                            comSkillAbel.skillBulletPos,
+                        )
+                    } else if (comSkillAbel.skillConfig.type == SKILL_TYPE.ejectionSkillBullet) {
                         let tmp = world.createRoleSkillBulletEntity(
-                            cfg[0],
+                            skillBulletParams[0],
                             entity,
                             0,
                             false,
@@ -113,27 +141,6 @@ export class SysSkillAbel extends ECSSystem {
                         if (tmp) comSkillAbel.bullets.push(tmp)
                     }
                 }
-                comSkillAbel.startDirty = false
-            }
-            //发射多枚技能子弹
-            if (comSkillAbel.skillConfig.type == SKILL_TYPE.skillBullet) {
-                let bulletNum =
-                    comSkillAbel.skillConfig.effectParm[
-                        comSkillAbel.skillConfig.effectType.indexOf(SKILL_EFFECT_TYPE.skillBullet)
-                    ][1]
-                comSkillAbel.skillBulletTime -= dt
-                if (bulletNum > 1 && comSkillAbel.skillBulletTime <= 0) {
-                    comSkillAbel.skillBulletTime = comSkillAbel.castSkillTime / (bulletNum - 1)
-                    world.createRoleSkillBulletEntity(
-                        comSkillAbel.skillConfig.effectParm[
-                            comSkillAbel.skillConfig.effectType.indexOf(SKILL_EFFECT_TYPE.skillBullet)
-                        ][0],
-                        entity,
-                        0,
-                        true,
-                        comSkillAbel.skillBulletPos,
-                    )
-                }
             }
             comSkillAbel.countDown -= dt
             if (comSkillAbel.countDown <= comSkillAbel.castSkillTime && comSkillAbel.skillDirty) {
@@ -287,30 +294,6 @@ export class SysSkillAbel extends ECSSystem {
                     comRole.HPDirty = true
                     comRole.transDirty = true
                     comTransRole.transID = comRole.roleCfg.ID
-                } else if (comSkillAbel.skillConfig.type == SKILL_TYPE.skillBullet) {
-                    let bulletID =
-                        comSkillAbel.skillConfig.effectParm[
-                            comSkillAbel.skillConfig.effectType.indexOf(SKILL_EFFECT_TYPE.skillBullet)
-                        ][0]
-                    let bulletConfig = BulletConfig[bulletID]
-                    if (bulletConfig) {
-                        let bulletEntity = world.createRoleSkillBulletEntity(
-                            bulletID,
-                            entity,
-                            bulletConfig.type == BULLET_TYPE.normal ? comSkillAbel.roles[0] : 0,
-                            false,
-                            bulletConfig.type == BULLET_TYPE.normal ? null : comSkillAbel.skillBulletPos,
-                        )
-                        if (!bulletEntity) {
-                            let curSkillIndex = comRole.skills.findIndex(
-                                value => value.ID == comSkillAbel.skillConfig.ID,
-                            )
-                            if (curSkillIndex >= 0) {
-                                //让技能可以重新被施放
-                                comRole.skillCountDowns[curSkillIndex] = comRole.castTime[curSkillIndex]
-                            }
-                        }
-                    }
                 }
                 //放技能加血
                 if (comRole.entryMap.get(ENTRY.skillRestoreHP)?.num > 0) {
@@ -320,18 +303,27 @@ export class SysSkillAbel extends ECSSystem {
                 }
             }
             if (comSkillAbel.countDown <= 0) {
-                comSkillAbel.isInShield = false
-                comSkillAbel.skillConfig = null
-                comSkillAbel.roles.length = 0
-                comSkillAbel.dirty = false
                 if (comSkillAbel.bullets) {
                     comSkillAbel.bullets.forEach(v => {
                         world.removeBulletEntity(v)
                     })
                     comSkillAbel.bullets.length = 0
                 }
+                comSkillAbel.isInShield = false
+                comSkillAbel.skillConfig = null
+                comSkillAbel.roles.length = 0
+                comSkillAbel.dirty = false
             }
             return false
         })
     }
+
+    getSkillBulletInverter(comSkillAbel: ComSkillAbel): number {
+        let cfg =
+            comSkillAbel.skillConfig.effectParm[
+                comSkillAbel.skillConfig.effectType.indexOf(SKILL_EFFECT_TYPE.skillBullet)
+            ]
+        if (!cfg) return 0
+        return cfg[2] ? cfg[2] : +(comSkillAbel.castSkillTime / cfg[1]).toFixed(1)
+    }
 }

+ 1 - 1
assets/script/ECS/worlds/WorldCocosView.ts

@@ -932,7 +932,7 @@ export class WorldCocosView extends ECSWorld {
         comBullet.hitEnemies.length = 0
         comBullet.isCrit = false
         //特效子弹位置随机
-        if (randomPos) {
+        if (randomPos && SkillConfig[bulletCfg.skill]) {
             let randomWidth = SkillConfig[bulletCfg.skill].attackRangeX
             let randomHeight = SkillConfig[bulletCfg.skill].attackRangeY
             let randomX = enemyComTransform.x + Math.randomRangeFloat(-randomWidth / 2, randomWidth / 2)