Kziwws 1 週間 前
コミット
08f8f1d77e

+ 5 - 5
assets/data/csv/enemy.csv

@@ -4,9 +4,9 @@ ID,名称,名称多语言,"类型
 number,string,string,number,number,number,number,number,number,number,number,number,string,string
 id,name,name_lang,type,hp,atk_speed,bullet_number,speed,weapon_id_1,weapon_id_2,min_interval,max_interval,prb_name,headshot
 10001,大兵,Soldier,1,70,1.5,1,1.5,1001,0,0,0.2,enemy,soldierPistol
-10002,狙击兵,Sniper,1,60,2.5,1,1.2,1002,0,0.1,0.3,enemy,sniperSoldier
-10003,盾牌兵,Shield Bearer,1,120,2,1,1,1001,1003,0.1,0.3,enemy,shieldSoldier
+10002,狙击兵,Sniper,1,60,1.2,1,1.2,1002,0,0.1,0.3,enemy,sniperSoldier
+10003,盾牌兵,Shield Bearer,1,120,1,1,1,1001,1003,0.1,0.3,enemy,shieldSoldier
 20001,狙击队长,Sniper Captain,2,240,2,1,1.25,1004,0,0,0.2,enemy,snipeCaptain
-20002,机枪队长,Boomstick,2,280,0.4,1,1.1,1005,0,0,0.2,enemy,scatterCaptain
-20003,坦克,Tank,2,480,3,1,0.5,1006,0,0.3,1.5,enemy,tank_enemy
-20004,将军,Sir Blasty,2,420,1.5,1,1.2,1007,0,0.5,1.2,enemy,generalPistol
+20002,机枪队长,Boomstick,2,280,2.5,1,1.1,1005,0,0,0.2,enemy,scatterCaptain
+20003,坦克,Tank,2,480,0.6,1,0.5,1006,0,0.3,1.5,enemy,tank_enemy
+20004,将军,Sir Blasty,2,420,2,1,1.2,1007,0,0.5,1.2,enemy,generalPistol

ファイルの差分が大きいため隠しています
+ 181 - 155
assets/prefabs/enemy/enemy.prefab


+ 2 - 2
assets/prefabs/map/map1.prefab

@@ -102,7 +102,7 @@
       "__id__": 1
     },
     "_children": [],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 3
@@ -391,7 +391,7 @@
       "__id__": 11
     },
     "_children": [],
-    "_active": false,
+    "_active": true,
     "_components": [
       {
         "__id__": 13

+ 27 - 8
assets/scripts/game/Enemy.ts

@@ -1,4 +1,4 @@
-import { _decorator, Node, Tween, Vec3, ProgressBar, UIOpacity, tween, Label, SkeletalAnimation, TiledUserNodeData, SphereCollider, CylinderCollider, MeshCollider} from 'cc';
+import { _decorator, Node, Tween, Vec3, ProgressBar, UIOpacity, tween, Label, SkeletalAnimation, Animation, SphereCollider, CylinderCollider, MeshCollider} from 'cc';
 import { Game } from './Game';
 import { Player } from './Player';
 import { Utils } from '../utils/Utils';
@@ -63,8 +63,11 @@ export class Enemy extends BaseExp {
     @autoBind({type: MeshCollider,tooltip: "坦克身体"})
     public tankCollider: MeshCollider  = null!;
 
-    //人物动画节点
-    private skeletalAnim: SkeletalAnimation  = null!;
+    //敌人动画节点
+    private skeletalAnim: SkeletalAnimation = null!;
+    //坦克的动画节点
+    private tankAnims:  Animation[] = []!;
+
     //根据敌人类型动态获取
     public enemyNode: Node  = null!;
     public oTween: Tween<object>;//敌人透明变化
@@ -135,8 +138,12 @@ export class Enemy extends BaseExp {
             let eTypeNode:Node = eNodes[i];
             eTypeNode.active = active;
             if(active){
-               this.enemyNode = eTypeNode;
-               this.skeletalAnim = eTypeNode.getComponent(SkeletalAnimation);
+                this.enemyNode = eTypeNode;
+                if(isTank){
+                   this.tankAnims = eTypeNode.getComponents(Animation);
+                }else{
+                   this.skeletalAnim = eTypeNode.getComponent(SkeletalAnimation);
+                }
             }
         });
         if(!this.enemyNode){
@@ -294,7 +301,12 @@ export class Enemy extends BaseExp {
         this.curMoveIndex = 0;
         this.pathList = points;
         const time: number = 1 / this.data.speed;
-        ResUtil.playSkeletalAnim(this.skeletalAnim,EAnimType.walk,time);
+        this.tankAnims
+        if(this.isTank()){
+           this.tankAnims[0].play();
+        }else{
+            ResUtil.playSkeletalAnim(this.skeletalAnim,EAnimType.walk,time);
+        }
         this.updateDir(points[0].clone());
     }
 
@@ -330,7 +342,9 @@ export class Enemy extends BaseExp {
         };
         this.removeGun();
         this.totalHP = 0;
-        this.skeletalAnim.play(EAnimType.die);
+        if(!this.isTank()){
+           this.skeletalAnim.play(EAnimType.die);
+        }
         this.isDead = true;
         this.hpBar.node.active = false;
         let death: Function = function(inite: boolean){
@@ -515,7 +529,12 @@ export class Enemy extends BaseExp {
         //到达路径终点处理
         if (this.curMoveIndex >= this.pathList.length) {
             this.beginFire();
-            this.skeletalAnim.play(EAnimType.shoot);
+            if(this.isTank()){
+                this.tankAnims[1].play();
+            }else{
+                const time: number = 1 / this.data.atk_speed;
+                ResUtil.playSkeletalAnim(this.skeletalAnim,EAnimType.walk,time);
+            }
             this.updateDir(this.node.worldPosition.clone());
         }
     }

+ 3 - 3
assets/scripts/game/GMap.ts

@@ -1,8 +1,8 @@
-import { _decorator, MeshRenderer, Node, SkeletalAnimation, UITransform, Vec3 } from 'cc';
+import { _decorator, MeshRenderer, Node, SkeletalAnimation, Vec3 } from 'cc';
 import { BaseExp } from '../core/base/BaseExp';
 import { autoBind } from '../extend/AutoBind';
 import { Utils } from '../utils/Utils';
-import { ResUtil } from '../utils/ResUtil';
+import { PAnimType } from './Player';
 import { EAnimType } from './Enemy';
 const { ccclass, property } = _decorator;
 
@@ -32,7 +32,7 @@ export class GMap extends BaseExp {
     public miidle_outline: Node = null;
     @autoBind({type:Node,tooltip:"进去的大门"})
     public doors: Node = null;
-    
+
     //埋伏点配置数组
     public ambushPoints: AmbushPoint[] = [];
     //游戏速度

+ 3 - 1
assets/scripts/game/Game.ts

@@ -70,8 +70,10 @@ export class Game extends BaseExp {
      */
     public restart(){
         this.isGameOver = this.isPause = false;
-        //加载敌人
+        //加载敌人 
         this.buildEnemys.loadLevelEnemys();
+        //创建玩家拥有的枪
+        this.player.restart();
     }
 
     /**

+ 15 - 2
assets/scripts/game/Player.ts

@@ -1,4 +1,4 @@
-import { _decorator, Node, SkeletalAnimation, Vec3 } from 'cc';
+import { _decorator, Node, SkeletalAnimation, Tween, Vec3 } from 'cc';
 import { BaseExp } from '../core/base/BaseExp';
 import { PoolManager } from '../core/manager/PoolManager';
 import { uiMgr } from '../core/manager/UIManager';
@@ -80,7 +80,7 @@ export class Player extends BaseExp {
      * @param name 枪的名字
      * @param isCut 是否是切换枪
      */
-    public loadGunName(name: string,isCut: boolean = false){
+    public loadGunName(name: string = this.pData.prb_name,isCut: boolean = false){
         //玩家待机状态
         this.player_skeletal.play(PAnimType.idle);
         this.pData = userIns.getCurUseGun();
@@ -125,6 +125,19 @@ export class Player extends BaseExp {
         });
     }
 
+    /**
+     * 重置
+     */
+    public restart(){
+        this.isDead = false;
+        this.isReloadMagazine = false;
+        this.shootUI.hpProgressBar.progress = 1;
+        Tween.stopAllByTarget(this.shootUI.injury_blood);
+        this.shootUI.injury_blood.active = false;
+        this.loadGunName();
+        this.player_skeletal.play(PAnimType.idle);
+    }
+
     /**
      * 玩家发射子弹
      */

+ 0 - 1
assets/scripts/ui/GunfightShootUI.ts

@@ -166,7 +166,6 @@ export class GunfightShootUI extends BaseExp {
            return;
         }
         this.crossHair.active = true;//准心
-        this.hpProgressBar.progress = 1;
         //步枪没有开镜贴图
         this.scopeOverlay.active = !this.isRifleGun();
         this.gun_name_label.string = gData.name_lang;

+ 1 - 2
assets/scripts/utils/ResUtil.ts

@@ -1,4 +1,4 @@
-import { _decorator, Asset, Component, Constructor, director, Node, ParticleSystem, Prefab, SceneAsset, SkeletalAnimation, Sprite, SpriteFrame, tween, UIOpacity, v2, v3, Vec3 } from 'cc';
+import { _decorator, Asset, Component, Constructor, director, Node, ParticleSystem, Prefab, SceneAsset, setPropertyEnumType, SkeletalAnimation, Sprite, SpriteFrame, tween, UIOpacity, UITransform, v2, v3, Vec3 } from 'cc';
 import { Utils } from './Utils';
 import { Constants } from '../data/Constants';
 import { bundleMgr } from '../core/manager/BundleManager';
@@ -322,7 +322,6 @@ export class ResUtil {
         }else{//恢复默认速度(避免之前的修改影响后续播放)
             clip.speed = 1;
         }
-        //换弹匣动画
         skeletal.play(name);
         if(cb){
            skeletal.scheduleOnce(cb,time);

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません