Kziwws há 1 semana atrás
pai
commit
dd4d93118f

Diff do ficheiro suprimidas por serem muito extensas
+ 30412 - 102
assets/prefabs/map/map1.prefab


+ 1 - 5
assets/scripts/game/BuildEnemys.ts

@@ -48,7 +48,6 @@ export class BuildEnemys extends Component {
         //总共每一个敌人延迟时间统计 0.1s检测一次
         let delay: number = 0;
         let interval: number = 0.0175;
-        let frist: number = 0.0;
         //敌人数据
         for(let idx = 0; idx < this.queueEnemys.length; idx++) {
             const eData:any = this.queueEnemys[idx];
@@ -56,9 +55,6 @@ export class BuildEnemys extends Component {
             let t: number = Utils.getRandomFloat(eData.min_interval,eData.max_interval);
             //延迟时间
             delay += t;
-            if(idx == 0){
-               frist = delay;
-            }
             let tData: any = {
                 data: eData,
                 delay: delay, 
@@ -83,6 +79,7 @@ export class BuildEnemys extends Component {
             },interval * 1000);
             this.eTimeMaps.set(tData,time_id);
         }
+        eventEmitter.dispatch(Constants.eventName.enemy_num_change);
     }
 
 
@@ -92,7 +89,6 @@ export class BuildEnemys extends Component {
     public readLevelEnemys(){
         const data: any = userIns.getCurLevelData();
         if(!data)return;
-        Game.I.player.setPlayerPos();
         //最终生成的敌人队列 普通敌人临时存储 BOSS敌人临时存储
         let enemyQueue = [],normalEnemies = [],bossEnemies = [];
         //拆分并处理每个敌人配置

+ 0 - 1
assets/scripts/game/Enemy.ts

@@ -343,7 +343,6 @@ export class Enemy extends BaseExp {
         if(f){//修改透明度
             let op: UIOpacity = this.node.getComponent(UIOpacity);
             this.oTween = tween(op)
-                .delay(0.4)
                 .to(0.15,{ opacity: 0})
                 .call(()=>{death();})
                 .start();

+ 18 - 12
assets/scripts/game/Game.ts

@@ -57,12 +57,13 @@ export class Game extends BaseExp {
     public nextLevel(){
         userIns.data.level += 1;
         //加载新的map
-        this.loadMap();
-        //刷新新的任务
-        uiMgr.getPageComponent(Constants.mainUIs.main).loadData();
-        this.isGameOver = this.isPause = false;
-        //加载敌人
-        this.buildEnemys.loadLevelEnemys();
+        this.loadMap(()=>{
+            this.isGameOver = this.isPause = false;
+            //刷新新的任务
+            uiMgr.getPageComponent(Constants.mainUIs.main).loadData();
+            //加载敌人
+            this.buildEnemys.loadLevelEnemys();
+        });
     }
 
     /**
@@ -70,17 +71,19 @@ export class Game extends BaseExp {
      */
     public restart(){
         //重新加载map
-        this.loadMap();
-        //创建玩家拥有的枪
-        this.player.restart();
-        //加载敌人 
-        this.buildEnemys.loadLevelEnemys();
+        this.loadMap(()=>{
+            //创建玩家拥有的枪
+            this.player.restart();
+            //加载敌人 
+            this.buildEnemys.loadLevelEnemys();
+        });
     }
 
     /**
      * 加载map
+     * @param cb 回调
      */
-    public loadMap(){
+    public loadMap(cb: Function = null){
         const name: string = userIns.getCurLevelData().map;
         if(Utils.isNull(name))return
         Logger.log(`加载地图:${name}`);
@@ -99,9 +102,12 @@ export class Game extends BaseExp {
             this.buildEnemys = this.map.getComponent(BuildEnemys);
             //玩家组建
             this.player = this.map.getComponentInChildren(Player);
+            //设置玩家位置
+            this.player.setPlayerPos();
             //主角摄像机
             const cameraNode: Node = Utils.findName(map, 'mainCamera');
             this.camera = cameraNode.getComponent(Camera);
+            cb?.();
         });
     }
 

+ 16 - 8
assets/scripts/game/Player.ts

@@ -36,8 +36,6 @@ export class Player extends BaseExp {
     public player_skeletal: SkeletalAnimation  = null!;
     @autoBind({type: PlayerCamera,tooltip: "玩家摄像机抖动控制"})
     public mainCamera: PlayerCamera = null!;
-    @autoBind({type: Node,tooltip: "玩家摄像机抖动控制"})
-    public GGGGGGG: Node = null!;
 
     /**玩家的位置节点*/
     public playPosNodes: Node[] = []!;
@@ -47,8 +45,6 @@ export class Player extends BaseExp {
     public isDead: boolean = false;
     /**玩家拥有的枪*/
     public gun: GunBase = null;
-    //玩家数据
-    public pData:any = null
     //是否去设置gunfightShootUI的基础信息
     public isCutShoot:boolean = false;
     //射击ui类
@@ -64,18 +60,29 @@ export class Player extends BaseExp {
     public isReloadMagazine: boolean = false;
     //玩家打敌人爆头的个数
     public headShotNum:number = 0;
-
-    start() {
+    //玩家数据改为私有属性
+    private _pData: any = null;
+    public get pData(): any {
+        if (!this._pData) {
+            this._pData = userIns.getCurUseGun();
+        }
+        return this._pData;
+    }
+    public set pData(value: any) {
+        this._pData = value;
+    }
+        
+    onEnable() {
         //隐藏玩家设置的位置坐标节点
         (this.playPosNodes = this.node.parent.getChildByName('player_points').children)
-            .forEach(e => e.active = false);
+                .forEach(e => e.active = false);
         //隐藏的枪的位置节点
         this.gun_pos.children.forEach(e => e.active = false);
-        this.pData = userIns.getCurUseGun();
         //创建玩家拥有的枪
         this.loadGunName(this.pData.prb_name);
     }
 
+    
     /**
      * 加载枪
      * @param name 枪的名字
@@ -227,6 +234,7 @@ export class Player extends BaseExp {
         const safeIndex = Math.min(data.point -1, length - 1);
         const n: Node = this.playPosNodes[safeIndex];
         this.node.worldPosition = n.worldPosition.clone();
+        this.node.eulerAngles = n.eulerAngles.clone();
     }
 
     /**

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

@@ -143,7 +143,7 @@ export class GunfightShootUI extends BaseExp {
      */
     public loadTaskData() {
         const data: any = userIns.getCurLevelData();
-        this.gun_name_label.string = i18n("main.关卡任务 %{value}",{value: data.id});
+        this.gk_num_lable.string = i18n("main.关卡任务 %{value}",{value: data.id});
         this.taskDatas = Game.I.buildEnemys.enemyTypeRecords;
         this.task_scrollView.numItems = this.taskDatas.length;
         //加载子弹的数据

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

@@ -3,6 +3,6 @@
   "config": {
     "images": [],
     "sceneUUID": {},
-    "scene": "6fdfa45a-54d2-427e-9510-d0cbbbc63997"
+    "scene": "b824d4a8-95d2-4112-8d63-f7df26c184ee"
   }
 }

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

@@ -2,7 +2,7 @@
   "__version__": "1.0.3",
   "builder": {},
   "gizmos-infos": {
-    "is2D": true,
+    "is2D": false,
     "is3DIcon": false,
     "iconSize": 2,
     "gridVisible": true,

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff