Kziwws 1 tuần trước cách đây
mục cha
commit
73a983f8af

+ 2 - 2
assets/prefabs/enemy/enemy.prefab

@@ -382,7 +382,7 @@
         "__id__": 22
       }
     ],
-    "_active": false,
+    "_active": true,
     "_components": [
       {
         "__id__": 962
@@ -57115,7 +57115,7 @@
         "__id__": 1926
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 2866

+ 17 - 16
assets/scripts/game/Enemy.ts

@@ -1,4 +1,4 @@
-import { _decorator, Node, Tween, Vec3, ProgressBar, UIOpacity, tween, Label, SkeletalAnimation, TiledUserNodeData} from 'cc';
+import { _decorator, Node, Tween, Vec3, ProgressBar, UIOpacity, tween, Label, SkeletalAnimation, TiledUserNodeData, SphereCollider, CylinderCollider, MeshCollider} from 'cc';
 import { Game } from './Game';
 import { Player } from './Player';
 import { Utils } from '../utils/Utils';
@@ -25,7 +25,7 @@ export enum EPartType {
 //敌人动作类型
 export enum EAnimType {
     idle = "idle",  //idle 待机状态
-    die = "run",  //run 死亡状态
+    die = "die",  //die 死亡状态
     shoot = "shoot", //shoot 射击状态
     walk = "walk", //shoot 行走状态
 }
@@ -56,12 +56,12 @@ export class Enemy extends BaseExp {
     public hpBar: ProgressBar  = null!;
     @autoBind({type: Node,tooltip: "敌人受伤节点"})
     public hurt_num: Node  = null!;
-    @autoBind({type: Node,tooltip: "敌人头部"})
-    public headCollider: Node  = null!;
-    @autoBind({type: Node,tooltip: "敌人身体"})
-    public bodyCollider: Node  = null!;
-    @autoBind({type: Node,tooltip: "坦克身体"})
-    public tankCollider: Node  = null!;
+    @autoBind({type: SphereCollider,tooltip: "敌人头部"})
+    public headCollider: SphereCollider  = null!;
+    @autoBind({type: CylinderCollider,tooltip: "敌人身体"})
+    public bodyCollider: CylinderCollider  = null!;
+    @autoBind({type: MeshCollider,tooltip: "坦克身体"})
+    public tankCollider: MeshCollider  = null!;
 
     //人物动画节点
     private skeletalAnim: SkeletalAnimation  = null!;
@@ -142,15 +142,16 @@ export class Enemy extends BaseExp {
             MsgHints.show(`不存在:${JSON.stringify(data)}`)
             return;
         }
-        if(!this.isTank() && this.skeletalAnim){
-            this.skeletalAnim.play(EAnimType.idle);
-            this.headCollider.active = true;
-            this.bodyCollider.active = true;
-            this.tankCollider.active = false;
+        if(this.isTank()){
+            this.skeletalAnim?.play(EAnimType.walk);
+            this.headCollider.enabled = false;
+            this.bodyCollider.enabled = false;
+            this.tankCollider.enabled = true;
         }else{
-            this.headCollider.active = true;
-            this.bodyCollider.active = true;
-            this.tankCollider.active = false;
+            this.skeletalAnim?.play(EAnimType.idle);
+            this.headCollider.enabled = true;
+            this.bodyCollider.enabled = true;
+            this.tankCollider.enabled = false;
         }
         this.player = Game.I.player.getComponent(Player);
         this.isAlert = false;

+ 1 - 1
profiles/v2/packages/reference-image.json

@@ -3,6 +3,6 @@
   "config": {
     "images": [],
     "sceneUUID": {},
-    "scene": "10795865-5525-41fc-8bf7-0e8d6983b214"
+    "scene": "28a9f61c-c9ee-4b56-acdd-86ed85c7d066"
   }
 }

+ 107 - 107
profiles/v2/packages/scene.json

@@ -739,31 +739,6 @@
       },
       "scale": 1
     },
-    "28a9f61c-c9ee-4b56-acdd-86ed85c7d066": {
-      "position": {
-        "x": 1.8915150205521203,
-        "y": 2.1491687434559794,
-        "z": 0.04508114808718736
-      },
-      "rotation": {
-        "x": -0.13754838650940646,
-        "y": 0.7802002679840002,
-        "z": 0.18449831158342309,
-        "w": 0.5816600005408824
-      },
-      "viewCenter": {
-        "x": -0.12900000000000006,
-        "y": 1.093,
-        "z": 0.647
-      },
-      "contentRect": {
-        "x": -818.8524536870619,
-        "y": -825.703324350213,
-        "width": 1362,
-        "height": 950
-      },
-      "scale": 0.5896782961306078
-    },
     "4718f98e-d9e4-476c-8f43-3883fc5bbae7": {
       "position": {
         "x": 4.833398358963072,
@@ -814,31 +789,6 @@
       },
       "scale": 0.5896782961306078
     },
-    "94719fcd-0e99-4a54-9b20-bc0a31782638": {
-      "position": {
-        "x": 0.22000000000002728,
-        "y": 0.9950000000000045,
-        "z": 6.780335755236365
-      },
-      "rotation": {
-        "x": 0,
-        "y": 0,
-        "z": 0,
-        "w": 1
-      },
-      "viewCenter": {
-        "x": 0.22,
-        "y": 0.995,
-        "z": 0.375
-      },
-      "contentRect": {
-        "x": -818.8524536870619,
-        "y": -825.703324350213,
-        "width": 1362,
-        "height": 950
-      },
-      "scale": 0.5896782961306078
-    },
     "24fa125d-82fa-4b02-888f-390a9c63f1b5": {
       "position": {
         "x": 0,
@@ -1139,31 +1089,6 @@
       },
       "scale": 1
     },
-    "645a2962-9d04-45c4-88ca-6701fe0cfbb7": {
-      "position": {
-        "x": 336.0145381432857,
-        "y": -20.17935794872244,
-        "z": 5000
-      },
-      "rotation": {
-        "x": 0,
-        "y": 0,
-        "z": 0,
-        "w": 1
-      },
-      "viewCenter": {
-        "x": 971.3775768799826,
-        "y": 1182.5234415514453,
-        "z": -469.0343109379155
-      },
-      "contentRect": {
-        "x": -818.8524536870619,
-        "y": -825.703324350213,
-        "width": 1362,
-        "height": 950
-      },
-      "scale": 0.5896782961306078
-    },
     "dd6c53c6-4cf3-4691-9db1-5959a144930a": {
       "position": {
         "x": -0.157,
@@ -1214,31 +1139,6 @@
       },
       "scale": 1
     },
-    "dbda5c7c-1e8b-4019-9399-09bf671d8101": {
-      "position": {
-        "x": 357.00178876687505,
-        "y": 801.4218682053222,
-        "z": 0.875785204912738
-      },
-      "rotation": {
-        "x": -0.12438096543375726,
-        "y": -0.59131251640409,
-        "z": -0.09293947154134302,
-        "w": 0.7913539903300199
-      },
-      "viewCenter": {
-        "x": 359.99377144277094,
-        "y": 800.4162816524506,
-        "z": -0.00847218707203865
-      },
-      "contentRect": {
-        "x": 0,
-        "y": 0,
-        "width": 1120,
-        "height": 950
-      },
-      "scale": 1
-    },
     "346da1f4-b662-4e36-9689-0854ae76da9f": {
       "position": {
         "x": 16.60738275901734,
@@ -1289,11 +1189,111 @@
       },
       "scale": 1
     },
+    "645a2962-9d04-45c4-88ca-6701fe0cfbb7": {
+      "position": {
+        "x": 336.0145381432857,
+        "y": -20.17935794872244,
+        "z": 5000
+      },
+      "rotation": {
+        "x": 0,
+        "y": 0,
+        "z": 0,
+        "w": 1
+      },
+      "viewCenter": {
+        "x": 971.3775768799826,
+        "y": 1182.5234415514453,
+        "z": -469.0343109379155
+      },
+      "contentRect": {
+        "x": 0,
+        "y": 0,
+        "width": 1120,
+        "height": 950
+      },
+      "scale": 1
+    },
+    "94719fcd-0e99-4a54-9b20-bc0a31782638": {
+      "position": {
+        "x": 0.22000000000002728,
+        "y": 0.9950000000000045,
+        "z": 6.780335755236365
+      },
+      "rotation": {
+        "x": 0,
+        "y": 0,
+        "z": 0,
+        "w": 1
+      },
+      "viewCenter": {
+        "x": 0.22,
+        "y": 0.995,
+        "z": 0.375
+      },
+      "contentRect": {
+        "x": 0,
+        "y": 0,
+        "width": 1120,
+        "height": 950
+      },
+      "scale": 1
+    },
+    "28a9f61c-c9ee-4b56-acdd-86ed85c7d066": {
+      "position": {
+        "x": 1.8915150205521059,
+        "y": 2.1491687434559807,
+        "z": 0.04508114808686514
+      },
+      "rotation": {
+        "x": -0.13754838650940646,
+        "y": 0.7802002679840002,
+        "z": 0.18449831158342309,
+        "w": 0.5816600005408824
+      },
+      "viewCenter": {
+        "x": -0.12900000000000006,
+        "y": 1.093,
+        "z": 0.647
+      },
+      "contentRect": {
+        "x": 0,
+        "y": 0,
+        "width": 1120,
+        "height": 950
+      },
+      "scale": 1
+    },
+    "dbda5c7c-1e8b-4019-9399-09bf671d8101": {
+      "position": {
+        "x": 359.1543916651964,
+        "y": 802.1499548197145,
+        "z": 2.608222232679867
+      },
+      "rotation": {
+        "x": -0.27437048301156647,
+        "y": -0.14850177634326023,
+        "z": -0.042928802920832655,
+        "w": 0.9491181055878559
+      },
+      "viewCenter": {
+        "x": 359.99377144277094,
+        "y": 800.4162816524506,
+        "z": -0.00847218707203865
+      },
+      "contentRect": {
+        "x": 0,
+        "y": 0,
+        "width": 1120,
+        "height": 950
+      },
+      "scale": 1
+    },
     "10795865-5525-41fc-8bf7-0e8d6983b214": {
       "position": {
         "x": 358.05249533760724,
         "y": 800,
-        "z": 1487.4224725134318
+        "z": 1659.2744246941159
       },
       "rotation": {
         "x": 0,
@@ -1309,8 +1309,8 @@
       "contentRect": {
         "x": 0,
         "y": 0,
-        "width": 388,
-        "height": 864
+        "width": 1120,
+        "height": 950
       },
       "scale": 1
     }
@@ -1343,10 +1343,8 @@
     "ea775253-49d0-4ed3-b61d-b95637b22a14",
     "f4a95669-6998-4e14-855c-0d5242a730f4",
     "5ee4992e-6d52-4123-9583-a4c06fbc1948",
-    "28a9f61c-c9ee-4b56-acdd-86ed85c7d066",
     "4718f98e-d9e4-476c-8f43-3883fc5bbae7",
     "b27497b3-42c4-4a2b-8bcf-8c0b7aac8559",
-    "94719fcd-0e99-4a54-9b20-bc0a31782638",
     "24fa125d-82fa-4b02-888f-390a9c63f1b5",
     "c418bfb3-8f04-402d-95bc-ba0ae00f18d6",
     "bb029c41-795e-4cc9-a143-8705fe3268fb",
@@ -1359,12 +1357,14 @@
     "a7a6f4b2-2950-4fdd-9c62-87fc8c2ccbb5",
     "a2423517-560c-435d-97c6-1e8ab247f69f",
     "ed15477d-4f3f-40d1-bdef-502972e9f657",
-    "645a2962-9d04-45c4-88ca-6701fe0cfbb7",
     "dd6c53c6-4cf3-4691-9db1-5959a144930a",
     "1e378c01-5a49-48fa-8204-6b008e0c4663",
-    "dbda5c7c-1e8b-4019-9399-09bf671d8101",
     "346da1f4-b662-4e36-9689-0854ae76da9f",
     "4844b5ae-cfad-4282-92e9-d58dae3b6445",
+    "645a2962-9d04-45c4-88ca-6701fe0cfbb7",
+    "94719fcd-0e99-4a54-9b20-bc0a31782638",
+    "28a9f61c-c9ee-4b56-acdd-86ed85c7d066",
+    "dbda5c7c-1e8b-4019-9399-09bf671d8101",
     "10795865-5525-41fc-8bf7-0e8d6983b214"
   ],
   "camera": {