瀏覽代碼

敌人死亡

181404010226 5 月之前
父節點
當前提交
9b4b617538

+ 4 - 4
assets/Scenes/GameLevel.scene

@@ -113,7 +113,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 360,
+      "x": 360.00000000000006,
       "y": 667,
       "z": 0
     },
@@ -304,7 +304,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 0,
+      "x": -5.684341886080802e-14,
       "y": 0,
       "z": 0
     },
@@ -20764,7 +20764,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": -310,
+      "x": -310.00000000000006,
       "y": 617,
       "z": 0
     },
@@ -25594,7 +25594,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 720,
+      "width": 720.0000000000001,
       "height": 1334
     },
     "_anchorPoint": {

+ 71 - 97
assets/Scenes/TestScene.scene

@@ -52,7 +52,7 @@
     },
     "autoReleaseAssets": false,
     "_globals": {
-      "__id__": 21
+      "__id__": 20
     },
     "_id": "8a125a67-dbc5-4c64-b398-6a616deee4aa"
   },
@@ -75,25 +75,25 @@
         "__id__": 8
       },
       {
-        "__id__": 13
+        "__id__": 10
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 18
+        "__id__": 17
       },
       {
-        "__id__": 19
+        "__id__": 18
       },
       {
-        "__id__": 20
+        "__id__": 19
       }
     ],
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 360,
+      "x": 360.00000000000006,
       "y": 667,
       "z": 0
     },
@@ -306,9 +306,6 @@
     "_components": [
       {
         "__id__": 9
-      },
-      {
-        "__id__": 10
       }
     ],
     "_prefab": null,
@@ -363,58 +360,26 @@
     },
     "_id": "cfovpox/1MQpypNWWd/J2W"
   },
-  {
-    "__type__": "5521cDvxK5HPqT+t4A5V6t6",
-    "_name": "",
-    "_objFlags": 0,
-    "__editorExtras__": {},
-    "node": {
-      "__id__": 8
-    },
-    "_enabled": true,
-    "__prefab": null,
-    "enemySpawner": {
-      "__id__": 11
-    },
-    "_id": "28iOiVK8FH35WoVa7lfD+2"
-  },
-  {
-    "__type__": "a2aacTp735IXaXYFWfbU79J",
-    "_name": "",
-    "_objFlags": 0,
-    "__editorExtras__": {},
-    "node": {
-      "__id__": 12
-    },
-    "_enabled": true,
-    "__prefab": null,
-    "enemyPrefab": {
-      "__uuid__": "b66f02ce-3078-432b-b943-3122a7221095",
-      "__expectedType__": "cc.Prefab"
-    },
-    "enemyContainer": {
-      "__id__": 14
-    },
-    "spawnInterval": 2,
-    "maxEnemies": 10,
-    "_id": "19KmKeAU9I+Yx+v9agD69e"
-  },
   {
     "__type__": "cc.Node",
-    "_name": "EnemySpawner",
+    "_name": "EnemyTest",
     "_objFlags": 0,
     "__editorExtras__": {},
     "_parent": {
-      "__id__": 13
+      "__id__": 2
     },
-    "_children": [],
-    "_active": true,
-    "_components": [
+    "_children": [
       {
-        "__id__": 17
+        "__id__": 11
       },
       {
-        "__id__": 11
+        "__id__": 14
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 16
       }
     ],
     "_prefab": null,
@@ -445,28 +410,24 @@
       "y": 0,
       "z": 0
     },
-    "_id": "8btBfVaMlG4YEWLd16PofE"
+    "_id": "aaEqR4mG1BepRJ//DnLaQ1"
   },
   {
     "__type__": "cc.Node",
-    "_name": "EnemyTest",
+    "_name": "EnemySpawner",
     "_objFlags": 0,
     "__editorExtras__": {},
     "_parent": {
-      "__id__": 2
+      "__id__": 10
     },
-    "_children": [
+    "_children": [],
+    "_active": true,
+    "_components": [
       {
         "__id__": 12
       },
       {
-        "__id__": 14
-      }
-    ],
-    "_active": true,
-    "_components": [
-      {
-        "__id__": 16
+        "__id__": 13
       }
     ],
     "_prefab": null,
@@ -497,7 +458,42 @@
       "y": 0,
       "z": 0
     },
-    "_id": "aaEqR4mG1BepRJ//DnLaQ1"
+    "_id": "8btBfVaMlG4YEWLd16PofE"
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 11
+    },
+    "_enabled": true,
+    "__prefab": null,
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 100
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": "8fJ0ObZ6tPgoXdZ4uQqk3K"
+  },
+  {
+    "__type__": "a59e9mJ/GxAm6uMO3zZOlms",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 11
+    },
+    "_enabled": true,
+    "__prefab": null,
+    "bulletSpeed": 300,
+    "_id": "d54nGM5BROFJT/TgNc92Ok"
   },
   {
     "__type__": "cc.Node",
@@ -505,7 +501,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "_parent": {
-      "__id__": 13
+      "__id__": 10
     },
     "_children": [],
     "_active": true,
@@ -572,7 +568,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 13
+      "__id__": 10
     },
     "_enabled": true,
     "__prefab": null,
@@ -588,28 +584,6 @@
     },
     "_id": "ce8uIBet1JdoKaW95g6Cxw"
   },
-  {
-    "__type__": "cc.UITransform",
-    "_name": "",
-    "_objFlags": 0,
-    "__editorExtras__": {},
-    "node": {
-      "__id__": 12
-    },
-    "_enabled": true,
-    "__prefab": null,
-    "_contentSize": {
-      "__type__": "cc.Size",
-      "width": 100,
-      "height": 100
-    },
-    "_anchorPoint": {
-      "__type__": "cc.Vec2",
-      "x": 0.5,
-      "y": 0.5
-    },
-    "_id": "8fJ0ObZ6tPgoXdZ4uQqk3K"
-  },
   {
     "__type__": "cc.UITransform",
     "_name": "",
@@ -622,7 +596,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 720,
+      "width": 720.0000000000001,
       "height": 1334
     },
     "_anchorPoint": {
@@ -681,28 +655,28 @@
   {
     "__type__": "cc.SceneGlobals",
     "ambient": {
-      "__id__": 22
+      "__id__": 21
     },
     "shadows": {
-      "__id__": 23
+      "__id__": 22
     },
     "_skybox": {
-      "__id__": 24
+      "__id__": 23
     },
     "fog": {
-      "__id__": 25
+      "__id__": 24
     },
     "octree": {
-      "__id__": 26
+      "__id__": 25
     },
     "skin": {
-      "__id__": 27
+      "__id__": 26
     },
     "lightProbeInfo": {
-      "__id__": 28
+      "__id__": 27
     },
     "postSettings": {
-      "__id__": 29
+      "__id__": 28
     },
     "bakedWithStationaryMainLight": false,
     "bakedWithHighpLightmap": false

+ 1 - 1
assets/assets/Prefabs/Pellet.prefab

@@ -154,7 +154,7 @@
       "__id__": 7
     },
     "speed": 300,
-    "damage": 10,
+    "damage": 1,
     "lifetime": 5,
     "_id": ""
   },

+ 55 - 55
assets/resources/data/enemies.json

@@ -7,7 +7,7 @@
       "rarity": "common",
       "weight": 35,
       "stats": {
-        "health": 100,
+        "health": 10,
         "speed": 50,
         "damage": 20,
         "attackRange": 30,
@@ -30,10 +30,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/001/001",
         "animations": {
-          "idle": "zombie_idle",
-          "walk": "zombie_walk",
-          "attack": "zombie_attack",
-          "death": "zombie_death"
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead"
         },
         "scale": 1.0,
         "flipX": false
@@ -53,7 +53,7 @@
       "rarity": "common",
       "weight": 25,
       "stats": {
-        "health": 180,
+        "health": 18,
         "speed": 40,
         "damage": 25,
         "attackRange": 30,
@@ -76,10 +76,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/002/002",
         "animations": {
-          "idle": "roadblock_idle",
-          "walk": "roadblock_walk",
-          "attack": "roadblock_attack",
-          "death": "roadblock_death",
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead",
           "block": "roadblock_block"
         },
         "scale": 1.1,
@@ -100,7 +100,7 @@
       "rarity": "uncommon",
       "weight": 20,
       "stats": {
-        "health": 120,
+        "health": 12,
         "speed": 45,
         "damage": 30,
         "attackRange": 40,
@@ -126,10 +126,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/003/003",
         "animations": {
-          "idle": "wandering_idle",
-          "walk": "wandering_walk",
-          "attack": "wandering_attack",
-          "death": "wandering_death"
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead"
         },
         "scale": 1.0,
         "flipX": false,
@@ -149,7 +149,7 @@
       "rarity": "uncommon",
       "weight": 18,
       "stats": {
-        "health": 80,
+        "health": 8,
         "speed": 35,
         "damage": 35,
         "attackRange": 200,
@@ -174,10 +174,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/004/004",
         "animations": {
-          "idle": "mage_idle",
-          "walk": "mage_walk",
-          "attack": "mage_cast",
-          "death": "mage_death"
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead"
         },
         "scale": 1.0,
         "flipX": false,
@@ -202,7 +202,7 @@
       "rarity": "uncommon",
       "weight": 16,
       "stats": {
-        "health": 90,
+        "health": 9,
         "speed": 40,
         "damage": 40,
         "attackRange": 250,
@@ -227,10 +227,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/005/005",
         "animations": {
-          "idle": "archer_idle",
-          "walk": "archer_walk",
-          "attack": "archer_shoot",
-          "death": "archer_death"
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead"
         },
         "scale": 1.0,
         "flipX": false,
@@ -255,7 +255,7 @@
       "rarity": "rare",
       "weight": 12,
       "stats": {
-        "health": 70,
+        "health": 7,
         "speed": 60,
         "damage": 45,
         "attackRange": 25,
@@ -278,10 +278,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/006/006",
         "animations": {
-          "idle": "stealth_idle",
-          "walk": "stealth_walk",
-          "attack": "stealth_attack",
-          "death": "stealth_death",
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead",
           "invisible": "stealth_invisible"
         },
         "scale": 1.0,
@@ -308,7 +308,7 @@
       "rarity": "uncommon",
       "weight": 15,
       "stats": {
-        "health": 300,
+        "health": 30,
         "speed": 30,
         "damage": 35,
         "attackRange": 30,
@@ -331,10 +331,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/007/007",
         "animations": {
-          "idle": "bucket_idle",
-          "walk": "bucket_walk",
-          "attack": "bucket_attack",
-          "death": "bucket_death",
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead",
           "armor_break": "bucket_armor_break"
         },
         "scale": 1.2,
@@ -361,7 +361,7 @@
       "rarity": "rare",
       "weight": 10,
       "stats": {
-        "health": 60,
+        "health": 6,
         "speed": 45,
         "damage": 25,
         "attackRange": 30,
@@ -386,10 +386,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/008/008",
         "animations": {
-          "idle": "barrel_idle",
-          "walk": "barrel_walk",
-          "attack": "barrel_attack",
-          "death": "barrel_death",
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead",
           "explode": "barrel_explode"
         },
         "scale": 1.0,
@@ -417,7 +417,7 @@
       "rarity": "boss",
       "weight": 1,
       "stats": {
-        "health": 800,
+        "health": 80,
         "speed": 25,
         "damage": 80,
         "attackRange": 50,
@@ -440,10 +440,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/009/009",
         "animations": {
-          "idle": "boss1_idle",
-          "walk": "boss1_walk",
-          "attack": "boss1_slam",
-          "death": "boss1_death",
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead",
           "block": "boss1_block"
         },
         "scale": 2.0,
@@ -474,7 +474,7 @@
       "rarity": "boss",
       "weight": 1,
       "stats": {
-        "health": 1000,
+        "health": 100,
         "speed": 20,
         "damage": 100,
         "attackRange": 60,
@@ -497,10 +497,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/010/010",
         "animations": {
-          "idle": "boss2_idle",
-          "walk": "boss2_walk",
-          "attack": "boss2_smash",
-          "death": "boss2_death",
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead",
           "summon": "boss2_summon"
         },
         "scale": 2.2,
@@ -531,7 +531,7 @@
       "rarity": "boss",
       "weight": 1,
       "stats": {
-        "health": 1200,
+        "health": 120,
         "speed": 35,
         "damage": 120,
         "attackRange": 80,
@@ -554,10 +554,10 @@
       "visualConfig": {
         "spritePrefab": "@EnemyAni/011/011",
         "animations": {
-          "idle": "boss3_idle",
-          "walk": "boss3_walk",
-          "attack": "boss3_combo",
-          "death": "boss3_death",
+          "idle": "idle",
+          "walk": "walk",
+          "attack": "attack",
+          "dead": "dead",
           "laser": "boss3_laser"
         },
         "scale": 2.5,

+ 10 - 42
assets/scripts/CombatSystem/BallController.ts

@@ -478,13 +478,7 @@ export class BallController extends Component {
 
     // 碰撞回调 - 简化版本用于测试
     onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
-        console.log('🎯 碰撞成功...');
-        console.log('碰撞对象:', {
-            self: selfCollider.node.name,
-            other: otherCollider.node.name,
-            otherGroup: otherCollider.group,
-            selfGroup: selfCollider.group
-        });
+        // Debug logs removed
         
         // 判断哪个是小球,哪个是方块
         let ballNode: Node = null;
@@ -503,14 +497,11 @@ export class BallController extends Component {
         
         // 如果没有找到小球,跳过处理
         if (!ballNode || !blockNode) {
-            console.log('❌ 未检测到小球参与的碰撞');
+            // Debug log removed
             return;
         }
         
-        console.log('✅ 检测到小球与方块碰撞:', {
-            ball: ballNode.name,
-            block: blockNode.name
-        });
+        // Debug log removed
         
         // 检查碰撞对象是否为方块
         const nodeName = blockNode.name;
@@ -523,11 +514,10 @@ export class BallController extends Component {
             nodePath.includes('Block') ||
             hasWeaponChild;
             
-        console.log('判定为方块:', isBlock);
+        // Debug log removed
             
         if (isBlock) {
-            console.log(`🎯 检测到方块碰撞: ${nodeName}, 路径: ${nodePath}`);
-            console.log('🚀 方块武器被激活,发射子弹攻击敌人...');
+            // trigger bullet without verbose logging
             // 计算碰撞世界坐标,默认用接触点
             let contactPos: Vec3 = null;
             if (contact && (contact as any).getWorldManifold) {
@@ -551,10 +541,7 @@ export class BallController extends Component {
 
     // 碰撞结束事件 - 简化版本
     onEndContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
-        console.log('🔚 碰撞结束:', {
-            self: selfCollider.node.name,
-            other: otherCollider.node.name
-        });
+        // Debug log removed
     }
     
     // 碰撞预处理事件 - 简化版本
@@ -611,12 +598,7 @@ export class BallController extends Component {
         }
         
         randomizedReflection.normalize();
-        console.log('反射方向:', {
-            original: direction,
-            normal: normal,
-            reflection: reflection,
-            randomized: randomizedReflection
-        });
+        // Debug log removed
         
         return randomizedReflection;
     }
@@ -627,6 +609,7 @@ export class BallController extends Component {
      * @param blockNode 激活的方块节点
      */
     fireBullet(blockNode: Node) {
+        // Debug logs removed
         console.log('🔫 === 方块武器发射子弹流程 ===');
         console.log('激活的方块:', blockNode.name);
         console.log('方块路径:', this.getNodePath(blockNode));
@@ -642,38 +625,23 @@ export class BallController extends Component {
         const weaponNode = this.findWeaponNode(blockNode);
         if (!weaponNode) {
             console.error('❌ 在方块中找不到Weapon节点:', blockNode.name);
-            console.log('方块结构:');
-            this.logNodeStructure(blockNode, 0);
-            
-            // 如果找不到Weapon节点,使用方块本身的位置作为发射位置
-            console.log('🔧 使用方块本身作为发射位置');
             const blockWorldPos = blockNode.worldPosition;
-            console.log('方块世界坐标:', blockWorldPos);
-            
-            // 直接创建子弹并设置位置
             this.createAndFireBullet(blockWorldPos);
-            
             console.log('🔫 === 方块武器发射子弹流程结束 ===');
             return;
         }
         
-        console.log('✅ 找到Weapon节点:', weaponNode.name);
-        console.log('Weapon节点路径:', this.getNodePath(weaponNode));
-        
         // 获取武器的世界坐标作为发射位置
         let firePosition: Vec3;
         try {
             firePosition = weaponNode.worldPosition;
-            console.log('武器世界坐标:', firePosition);
         } catch (error) {
             console.error('❌ 获取武器坐标失败:', error);
             // 备用方案:使用方块坐标
             firePosition = blockNode.worldPosition;
-            console.log('使用方块坐标作为备用:', firePosition);
         }
         
         // 创建并发射子弹
-        console.log('🚀 创建子弹...');
         this.createAndFireBullet(firePosition);
         
         console.log('🔫 === 方块武器发射子弹流程结束 ===');
@@ -692,8 +660,7 @@ export class BallController extends Component {
             console.error('❌ 子弹实例创建失败');
             return;
         }
-        console.log('✅ 子弹实例创建成功:', bullet.name);
-        
+
         // 获取子弹控制器并设置发射位置
         const bulletController = bullet.getComponent(BulletController);
         if (!bulletController) {
@@ -750,6 +717,7 @@ export class BallController extends Component {
     
     // 递归查找Weapon节点
     private findWeaponNode(node: Node): Node | null {
+        // logs removed
         console.log(`🔍 在节点 ${node.name} 中查找Weapon...`);
         
         // 先检查当前节点是否有Weapon子节点

+ 1 - 1
assets/scripts/CombatSystem/BulletController.ts

@@ -16,7 +16,7 @@ export class BulletController extends Component {
     public speed: number = 300;
 
     @property
-    public damage: number = 10;
+    public damage: number = 1;
 
     @property
     public lifetime: number = 5;

+ 51 - 13
assets/scripts/CombatSystem/EnemyInstance.ts

@@ -16,7 +16,8 @@ interface EnemyControllerType {
 // 敌人状态枚举
 enum EnemyState {
     MOVING,   // 移动中
-    ATTACKING // 攻击中
+    ATTACKING, // 攻击中
+    DEAD      // 死亡
 }
 
 // 单个敌人实例的组件
@@ -52,6 +53,9 @@ export class EnemyInstance extends Component {
     // 骨骼动画组件
     private skeleton: sp.Skeleton | null = null;
 
+    // 调试标记,避免重复输出日志
+    private _debugFlag: boolean = false;
+
     start() {
         // 初始化敌人
         this.initializeEnemy();
@@ -153,10 +157,12 @@ export class EnemyInstance extends Component {
         this.updateHealthDisplay();
         
         // 如果血量低于等于0,销毁敌人
-        if (this.health <= 0) {
-            // 通知控制器即将死亡,由 controller 统一通知 GameManager
-            // 避免重复调用 onEnemyKilled
-            this.node.destroy();
+        if (this.health <= 0 && this.state !== EnemyState.DEAD) {
+            this.state = EnemyState.DEAD;
+            // 进入死亡流程,禁用碰撞避免重复命中
+            const col = this.getComponent(Collider2D);
+            if (col) col.enabled = false;
+            this.playDeathAnimationAndDestroy();
         }
     }
 
@@ -173,15 +179,17 @@ export class EnemyInstance extends Component {
         } else if (this.state === EnemyState.ATTACKING) {
             this.updateAttack(deltaTime);
         }
+
+        // 不再每帧播放攻击动画,避免日志刷屏
     }
     
     // 更新移动逻辑
     private updateMovement(deltaTime: number) {
         // 检查是否接近游戏区域边界
         if (this.checkNearGameArea()) {
-            // 如果接近游戏区域,停止移动并开始攻击
             this.state = EnemyState.ATTACKING;
-            this.attackTimer = 0; // 立即开始攻击
+            this.attackTimer = 0;
+            this.playAttackAnimation();
             return;
         }
         
@@ -266,18 +274,48 @@ export class EnemyInstance extends Component {
     // 播放行走动画
     private playWalkAnimation() {
         if (!this.skeleton) return;
-        if (this.skeleton.findAnimation('walk')) {
-            this.skeleton.setAnimation(0, 'walk', true);
-        } else if (this.skeleton.findAnimation('idle')) {
-            this.skeleton.setAnimation(0, 'idle', true);
+        const enemyComp = this.getComponent('EnemyComponent') as any;
+        const anims = enemyComp?.getAnimations ? enemyComp.getAnimations() : {};
+        const walkName = anims.walk ?? 'walk';
+        const idleName = anims.idle ?? 'idle';
+
+        if (this.skeleton.findAnimation(walkName)) {
+            this.skeleton.setAnimation(0, walkName, true);
+        } else if (this.skeleton.findAnimation(idleName)) {
+            this.skeleton.setAnimation(0, idleName, true);
         }
     }
 
     // 播放攻击动画
     private playAttackAnimation() {
         if (!this.skeleton) return;
-        if (this.skeleton.findAnimation('attack')) {
-            this.skeleton.setAnimation(0, 'attack', true);
+        const enemyComp2 = this.getComponent('EnemyComponent') as any;
+        const anims2 = enemyComp2?.getAnimations ? enemyComp2.getAnimations() : {};
+        const attackName = anims2.attack ?? 'attack';
+
+        // 移除频繁打印
+
+        if (this.skeleton.findAnimation(attackName)) {
+            this.skeleton.setAnimation(0, attackName, true);
+        }
+    }
+
+    private playDeathAnimationAndDestroy() {
+        if (this.skeleton) {
+            const enemyComp = this.getComponent('EnemyComponent') as any;
+            const anims = enemyComp?.getAnimations ? enemyComp.getAnimations() : {};
+            const deathName = anims.dead ?? 'dead';
+
+            if (this.skeleton.findAnimation(deathName)) {
+                this.skeleton.setAnimation(0, deathName, false);
+                // 销毁节点在动画完毕后
+                this.skeleton.setCompleteListener(() => {
+                    this.node.destroy();
+                });
+                return;
+            }
         }
+        // 若无动画直接销毁
+        this.node.destroy();
     }
 }