woso_javan hai 1 mes
pai
achega
f4c87ef63d

+ 47 - 0
assets/module_aliens/Script/Components/HeadShotTipComponent.ts

@@ -0,0 +1,47 @@
+import { _decorator, Component, Game, Node, tween, UIOpacity } from 'cc';
+import { EventDispatcher } from 'db://assets/core_tgx/easy_ui_framework/EventDispatcher';
+import { GameEvent } from '../Enum/GameEvent';
+const { ccclass, property } = _decorator;
+
+@ccclass('HeadTipComponent')
+export class HeadTipComponent extends Component {
+    private _children: Node[] = [];
+
+    protected onLoad(): void {
+        EventDispatcher.instance.on(GameEvent.EVENT_CAMERA_HEADSHOT,this.showTip,this);
+    }
+
+    start() {
+        // 获取所有子节点
+        this._children = this.node.children;
+        // 初始隐藏所有提示
+        this._children.forEach(child => child.active = false);
+    }
+
+    showTip() {
+        if (this._children.length < 2) return;
+        
+        // 随机选择一个子节点
+        const randomIndex = Math.floor(Math.random() * this._children.length);
+        const tipNode = this._children[randomIndex];
+        
+        // 显示节点并添加淡出效果
+        tipNode.active = true;
+        const uiOpacity = tipNode.getComponent(UIOpacity) || tipNode.addComponent(UIOpacity);
+        uiOpacity.opacity = 255;
+        
+        tween(uiOpacity)
+            .delay(0.5)
+            .to(0.3, { opacity: 0 })
+            .call(() => {
+                tipNode.active = false;
+            })
+            .start();
+    }
+
+    update(deltaTime: number) {
+        
+    }
+}
+
+

+ 9 - 0
assets/module_aliens/Script/Components/HeadShotTipComponent.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "d033a738-a5eb-4f81-8d9d-2c0e867ab41f",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 3 - 0
assets/module_aliens/Script/Enum/GameEvent.ts

@@ -32,6 +32,9 @@ export class GameEvent {
     /** 隐藏瞄准节点*/
     static readonly EVENT_CAMERA_HIDE_AIM = 'EVENT_CAMERA_HIDE_AIM';
 
+    /** 爆头事件*/
+    static readonly EVENT_CAMERA_HEADSHOT = 'EVENT_CAMERA_HEADSHOT';
+
     /** 显示瞄准节点*/
 
     /** 发射射击*/

+ 2 - 0
assets/module_aliens/Script/LevelAction.ts

@@ -164,6 +164,8 @@ export class LevelAction extends Component {
 
                 if(item.collider.getGroup() == 1 << 4) {
                     LevelManager.instance.levelModel.headshotCount++;
+                    console.log('爆头了!!!!!!!!!!!!')
+                    EventDispatcher.instance.emit(GameEvent.EVENT_CAMERA_HEADSHOT); // 触发事件通知UI显示headshot di
                 }
 
                 if (hitNode.getComponent(EnemyComponent)) {

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 388 - 190
assets/module_aliens/rooster_aliens.scene


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

@@ -1214,8 +1214,8 @@
     },
     "19323c5d-5d36-438a-86ee-8288c690e5b0": {
       "position": {
-        "x": 42.954999999999984,
-        "y": 91.3533333333333,
+        "x": 45.67749999999998,
+        "y": 97.14333333333332,
         "z": 5000
       },
       "rotation": {
@@ -1264,8 +1264,8 @@
     },
     "be14c61f-22d8-4bb9-b444-ad9f29740469": {
       "position": {
-        "x": 433.5,
-        "y": 403.49999999999994,
+        "x": 257.3178554644597,
+        "y": 242.33178214870213,
         "z": 5000
       },
       "rotation": {
@@ -1280,12 +1280,12 @@
         "z": 0
       },
       "contentRect": {
-        "x": 263.8983688833124,
-        "y": 45.56461731493099,
+        "x": -364.78367040797895,
+        "y": -1070.5809903641757,
         "width": 856.2565055762082,
         "height": 797
       },
-      "scale": 0.9876084262701363
+      "scale": 0.2692486564232375
     }
   },
   "camera-uuids": [

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio