Преглед на файлове

2025-05-28 wws 修改bug

2025-05-28 wws 修改bug
Kziwws преди 1 седмица
родител
ревизия
96dbc7cb47

Файловите разлики са ограничени, защото са твърде много
+ 109 - 7055
assets/prefabs/enemy/pistol.prefab


Файловите разлики са ограничени, защото са твърде много
+ 106 - 7052
assets/prefabs/enemy/scatter.prefab


Файловите разлики са ограничени, защото са твърде много
+ 106 - 7052
assets/prefabs/enemy/sniper_rifle.prefab


Файловите разлики са ограничени, защото са твърде много
+ 106 - 7052
assets/prefabs/enemy/tank_pao.prefab


Файловите разлики са ограничени, защото са твърде много
+ 634 - 126
assets/prefabs/page/main.prefab


+ 1 - 1
assets/prefabs/page/main.prefab.meta

@@ -2,7 +2,7 @@
   "ver": "1.1.50",
   "importer": "prefab",
   "imported": true,
-  "uuid": "659d5670-dfc2-4962-bbeb-03f35b5ff38b",
+  "uuid": "9d4a53fa-0138-49c2-aa32-b0160c1c3d17",
   "files": [
     ".json"
   ],

BIN
assets/prefabs/texture/tank_enemy.png


+ 20 - 20
assets/prefabs/texture/tank_enemy.png.meta

@@ -45,10 +45,10 @@
         "offsetY": 0,
         "trimX": 0,
         "trimY": 0,
-        "width": 111,
-        "height": 144,
-        "rawWidth": 111,
-        "rawHeight": 144,
+        "width": 170,
+        "height": 115,
+        "rawWidth": 170,
+        "rawHeight": 115,
         "borderTop": 0,
         "borderBottom": 0,
         "borderLeft": 0,
@@ -60,17 +60,17 @@
         "meshType": 0,
         "vertices": {
           "rawPosition": [
-            -55.5,
-            -72,
+            -85,
+            -57.5,
             0,
-            55.5,
-            -72,
+            85,
+            -57.5,
             0,
-            -55.5,
-            72,
+            -85,
+            57.5,
             0,
-            55.5,
-            72,
+            85,
+            57.5,
             0
           ],
           "indexes": [
@@ -83,12 +83,12 @@
           ],
           "uv": [
             0,
-            144,
-            111,
-            144,
+            115,
+            170,
+            115,
             0,
             0,
-            111,
+            170,
             0
           ],
           "nuv": [
@@ -102,13 +102,13 @@
             1
           ],
           "minPos": [
-            -55.5,
-            -72,
+            -85,
+            -57.5,
             0
           ],
           "maxPos": [
-            55.5,
-            72,
+            85,
+            57.5,
             0
           ]
         },

Файловите разлики са ограничени, защото са твърде много
+ 187 - 362
assets/prefabs/ui/gunfightShootUI.prefab


Файловите разлики са ограничени, защото са твърде много
+ 162 - 129
assets/scenes/game.scene


+ 4 - 7
assets/scripts/game/BuildEnemys.ts

@@ -56,8 +56,6 @@ export class BuildEnemys extends Component {
             || Game.I.isPause)return;
         this.recycle();
         this.queueEnemys = this.readLevelEnemys();
-        this.eTimeMaps.forEach((k,v) => {if(v){clearInterval(v)}});
-        this.eTimeMaps.clear();
         //总共每一个敌人延迟时间统计 0.1s检测一次
         let delay: number = 0;
         let interval: number = 0.0175;
@@ -151,12 +149,11 @@ export class BuildEnemys extends Component {
             ||!Game.I.map
             ||!this.allEnemys
             ||!data)return;
-        let item:Node = await ResUtil.loadEnemyRes(data.prb_name,Game.I.map.node);
+        let item:Node = await ResUtil.loadEnemyRes(data.prb_name);
+        item.active = true;
+        item.parent = Game.I.map.node;
         const posArr:Vec3[] = this.map.getPaths(data);
-        //创建绕Y轴旋转90度的四元数
-        /*const rotation = new Quat();
-        Quat.fromAxisAngle(rotation, Vec3.UP, Math.PI / 2)
-        e.node.rotate(rotation, NodeSpace.WORLD);*/
+        item.worldPosition = posArr[0];
         let e:Enemy = item.getComponent(Enemy);
         await e.init(data);
         e.walk(posArr);

+ 9 - 9
assets/scripts/game/Enemy.ts

@@ -161,14 +161,14 @@ export class Enemy extends BaseExp {
         //设置血量
         this.totalHP = data.hp;
         //敌人速度
-        const s: number = data.speed * 4;
+        const s: number = data.speed * 3;
         this.speed = s;
         this.defaultSpeed = s;
         //设置枪的数据
         await this.createGun();
         //恢复初始雪条
         this.hpBar.progress = 1;
-        this.hpBar.node.active = true;
+        this.hpBar.node.active = false;
         this.endFire();   
     }
 
@@ -198,7 +198,6 @@ export class Enemy extends BaseExp {
     public async createGun(){
         this.removeGun();
         //敌人主武器
-        console.log("FFFFF = " + this.enemyNode.name);
         let gunPos:Node = this.enemyNode.getChildByName("gun_pos");
         const mainWeaponID:number = this.data.weapon_id_1;
         let mData:any = userIns.enemyWeaponTable.find(e=>e.gun_id == mainWeaponID);
@@ -261,6 +260,10 @@ export class Enemy extends BaseExp {
             ||this.totalHP <= 0){
             return;
         }
+        this.hpBar.node.active = true;
+        this.scheduleOnce(() => {
+            if(this.hpBar){this.hpBar.node.active = false;}
+        }, 0.8);
         this.totalHP -= hp;
         //这种是伤害超级高直接死亡了
         if(hp > this.totalHP){
@@ -291,18 +294,14 @@ export class Enemy extends BaseExp {
         this.curMoveIndex = 0;
         this.pathList = points;
         this.skeletalAnim.play(EAnimType.walk);
-        //开始位置
-        const startPos: Vec3 = points[0];
-        this.node.worldPosition = startPos;
-        this.updateDir(startPos);
-
+        this.updateDir(points[0].clone());
     }
 
     /**
      * 开始攻击
      */
     public beginFire(){
-        if(this.player != null 
+        if(this.player
             && !this.player.isDead 
             && this.gun){
             this.isFire = true;
@@ -508,6 +507,7 @@ export class Enemy extends BaseExp {
         }
         //到达路径终点处理
         if (this.curMoveIndex >= this.pathList.length) {
+            this.beginFire();
             this.skeletalAnim.play(EAnimType.shoot);
             this.updateDir(this.node.worldPosition.clone());
         }

+ 0 - 13
assets/scripts/items/enmey/Bullet10.ts

@@ -78,7 +78,6 @@ export class Bullet10 extends BulletBase {
         const isHit = phy.raycast(ray, 0xffffff, len);
         if (isHit && phy.raycastResults.length > 0) {
             let result:PhysicsRayResult = phy.raycastResults[0];    
-            this.addImpact(result);
             if(result.collider.getComponent(RigidBody)) {
                result.collider.getComponent(RigidBody).applyForce(this.vector, result.hitPoint);
             }
@@ -92,16 +91,4 @@ export class Bullet10 extends BulletBase {
             this.autoRecycle();
         }
     }
-
-    /**
-     * 加入射击中的效果
-     * @param e 碰撞到的结果
-     */
-    private addImpact(e:PhysicsRayResult) {
-        let impact: Node = PoolManager.getNode((this.gunBase as unknown as Gun10).impact);
-        impact.worldPosition = e.hitPoint.add(e.hitNormal.multiplyScalar(0.01));
-        impact.forward = e.hitNormal.multiplyScalar(-1);
-        impact.scale = this.node.scale;
-        impact.setParent(e.collider.node,true);
-    }
 }

+ 0 - 13
assets/scripts/items/enmey/Bullet14.ts

@@ -78,7 +78,6 @@ export class Bullet14 extends BulletBase {
         const isHit = phy.raycast(ray, 0xffffff, len);
         if (isHit && phy.raycastResults.length > 0) {
             let result:PhysicsRayResult = phy.raycastResults[0];    
-            this.addImpact(result);
             if(result.collider.getComponent(RigidBody)) {
                result.collider.getComponent(RigidBody).applyForce(this.vector, result.hitPoint);
             }
@@ -90,16 +89,4 @@ export class Bullet14 extends BulletBase {
             this.autoRecycle();
         }
     }
-
-    /**
-     * 加入射击中的效果
-     * @param e 碰撞到的结果
-     */
-    private addImpact(e:PhysicsRayResult) {
-        let impact: Node = PoolManager.getNode((this.gunBase as unknown as Gun14).impact);
-        impact.worldPosition = e.hitPoint.add(e.hitNormal.multiplyScalar(0.01));
-        impact.forward = e.hitNormal.multiplyScalar(-1);
-        impact.scale = this.node.scale;
-        impact.setParent(e.collider.node,true);
-    }
 }

+ 3 - 6
assets/scripts/items/enmey/Gun10.ts

@@ -6,6 +6,8 @@ import { Bullet10 } from './Bullet10';
 import { Utils } from '../../utils/Utils';
 import { Enemy } from '../../game/Enemy';
 import { Player } from '../../game/Player';
+import { audioMgr } from '../../core/manager/AudioManager';
+import { Constants } from '../../data/Constants';
 const { ccclass, property } = _decorator;
 
 /**敌人所使用的枪 */
@@ -18,8 +20,6 @@ const { ccclass, property } = _decorator;
 export class Gun10 extends GunBase {
     @property({type: Node,tooltip:"子弹节点"})
     public bulletNode: Node = null!;
-    @property({type: Node,tooltip:"烟雾特效"})
-    public impact: Node = null!
     @property({type: Node,tooltip:"开火特效节点"})
     fireEffect: Node = null;
 
@@ -47,7 +47,6 @@ export class Gun10 extends GunBase {
 
     onLoad() {
         this.bulletNode.active = false;
-        this.impact.active = false;
         this.muzzleNode.active = false;
     }
 
@@ -159,9 +158,7 @@ export class Gun10 extends GunBase {
                 this.r_delay = Utils.getRandomFloat(0,m); 
                 this.diff = 0;
                 this.isGo = false;
-                //audioMgr.playOneShot(this.data.gun_sound);
-                //播放射击帧动画
-                //this.playShootAnim();
+                audioMgr.playOneShot(Constants.audios.Enemy_attack);
                 this.createBullet();
                 this.curTime = 0;
                 this.isCb = false;

+ 0 - 3
assets/scripts/items/enmey/Gun14.ts

@@ -13,8 +13,6 @@ const { ccclass, property } = _decorator;
 export class Gun14 extends GunBase {
     @property({type: Node,tooltip:"子弹节点"})
     public bulletNode: Node = null!;
-    @property({type: Node,tooltip:"烟雾特效"})
-    public impact: Node = null!
     @property({type: Node,tooltip:"开火特效节点"})
     fireEffect: Node = null;
 
@@ -42,7 +40,6 @@ export class Gun14 extends GunBase {
 
     onLoad() {
         this.bulletNode.active = false;
-        this.impact.active = false;
         this.muzzleNode.active = false;
     }
 

+ 16 - 10
assets/scripts/ui/GunfightShootUI.ts

@@ -161,11 +161,8 @@ export class GunfightShootUI extends BaseExp {
         const gData:any = Game.I.player.pData;
         if(!gData)return;
         this.crossHair.active = true;//准心
-        if(gData.type == 2){//步枪
-           this.scopeOverlay.active = false;//标准贴图
-        }else{
-            this.scopeOverlay.active = true;//标准贴图
-        }
+        //步枪没有开镜贴图
+        this.scopeOverlay.active = !this.isRifleGun();
         this.gun_name_label.string = gData.name_lang;
         const isSnipeGun: boolean = gData.type == 1;
         //换弹夹进度条
@@ -324,10 +321,10 @@ export class GunfightShootUI extends BaseExp {
         this.isZoomingIn = true;
         //将 zoomingSpeed 转换为持续时间(450对应1.2秒)
         this.zoomDuration = 72 / gData.zoomingSpeed;
-        //使用枪械类型决定视口倍数
+        //使用枪械类型决定视口倍数 步枪使用 rifleZoom 狙击枪使用 scopeZoom
         const zoomMultiplier = isRifle ? 
-            1 / gData.rifleZoom :   // 步枪使用 rifleZoom
-            1 / gData.scopeZoom;    // 狙击枪使用 scopeZoom
+            1 / gData.rifleZoom :
+            1 / gData.scopeZoom; 
         this.targetFov = this.originalFov * zoomMultiplier;
         //保持原有速度计算逻辑
         const fovDifference = this.originalFov - this.targetFov;
@@ -365,7 +362,7 @@ export class GunfightShootUI extends BaseExp {
         let screenPos = camera2D.worldToScreen(worldPos);
         //校准补偿准心的偏移量
         screenPos.x -= 0;
-        screenPos.y += 20;
+        screenPos.y += this._isScopeOpen ? 80 : 20;
         //从摄像机发射通过准心的射线
         const ray = new geometry.Ray();
         Game.I.camera.screenPointToRay(screenPos.x, screenPos.y, ray);
@@ -413,7 +410,16 @@ export class GunfightShootUI extends BaseExp {
         if (btnName === 'pause_btn') { // 暂停页面
             uiMgr.show(Constants.popUIs.pauseUI);
         }else if (btnName === 'shot_btn') {//射击
-            Game.I.player.shoot();
+            if(this.isRifleGun){
+                //模拟按下射击
+                this._isScopeOpen = true;
+                Game.I.player.shoot();
+                this.scheduleOnce(()=>{
+                    this._isScopeOpen = false;
+                },1.5)
+            }else{
+                Game.I.player.shoot();
+            }
         }else if (btnName === 'cut_gun_btn') {//切枪
             Game.I.player.randomCutGun()
         }else if(btnName === 'clean_btn'){//重新加载数据

BIN
assets/textures/main/QieHuan.png


+ 134 - 0
assets/textures/main/QieHuan.png.meta

@@ -0,0 +1,134 @@
+{
+  "ver": "1.0.27",
+  "importer": "image",
+  "imported": true,
+  "uuid": "3701a91c-e0eb-4177-93b0-69c9943f53ca",
+  "files": [
+    ".json",
+    ".png"
+  ],
+  "subMetas": {
+    "6c48a": {
+      "importer": "texture",
+      "uuid": "3701a91c-e0eb-4177-93b0-69c9943f53ca@6c48a",
+      "displayName": "QieHuan",
+      "id": "6c48a",
+      "name": "texture",
+      "userData": {
+        "wrapModeS": "clamp-to-edge",
+        "wrapModeT": "clamp-to-edge",
+        "imageUuidOrDatabaseUri": "3701a91c-e0eb-4177-93b0-69c9943f53ca",
+        "isUuid": true,
+        "visible": false,
+        "minfilter": "linear",
+        "magfilter": "linear",
+        "mipfilter": "none",
+        "anisotropy": 0
+      },
+      "ver": "1.0.22",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    },
+    "f9941": {
+      "importer": "sprite-frame",
+      "uuid": "3701a91c-e0eb-4177-93b0-69c9943f53ca@f9941",
+      "displayName": "QieHuan",
+      "id": "f9941",
+      "name": "spriteFrame",
+      "userData": {
+        "trimThreshold": 1,
+        "rotated": false,
+        "offsetX": 0,
+        "offsetY": 0,
+        "trimX": 0,
+        "trimY": 0,
+        "width": 166,
+        "height": 109,
+        "rawWidth": 166,
+        "rawHeight": 109,
+        "borderTop": 0,
+        "borderBottom": 0,
+        "borderLeft": 0,
+        "borderRight": 0,
+        "packable": true,
+        "pixelsToUnit": 100,
+        "pivotX": 0.5,
+        "pivotY": 0.5,
+        "meshType": 0,
+        "vertices": {
+          "rawPosition": [
+            -83,
+            -54.5,
+            0,
+            83,
+            -54.5,
+            0,
+            -83,
+            54.5,
+            0,
+            83,
+            54.5,
+            0
+          ],
+          "indexes": [
+            0,
+            1,
+            2,
+            2,
+            1,
+            3
+          ],
+          "uv": [
+            0,
+            109,
+            166,
+            109,
+            0,
+            0,
+            166,
+            0
+          ],
+          "nuv": [
+            0,
+            0,
+            1,
+            0,
+            0,
+            1,
+            1,
+            1
+          ],
+          "minPos": [
+            -83,
+            -54.5,
+            0
+          ],
+          "maxPos": [
+            83,
+            54.5,
+            0
+          ]
+        },
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "3701a91c-e0eb-4177-93b0-69c9943f53ca@6c48a",
+        "atlasUuid": "",
+        "trimType": "auto"
+      },
+      "ver": "1.0.12",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    }
+  },
+  "userData": {
+    "type": "sprite-frame",
+    "hasAlpha": true,
+    "fixAlphaTransparencyArtifacts": false,
+    "redirect": "3701a91c-e0eb-4177-93b0-69c9943f53ca@6c48a"
+  }
+}

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

@@ -3,6 +3,6 @@
   "config": {
     "images": [],
     "sceneUUID": {},
-    "scene": "28a9f61c-c9ee-4b56-acdd-86ed85c7d066"
+    "scene": "f4a95669-6998-4e14-855c-0d5242a730f4"
   }
 }

Някои файлове не бяха показани, защото твърде много файлове са промени