Selaa lähdekoodia

离卦出现龙卷风时胖子消失

LAPTOP-OM1V99U2\永远de小亡灵 1 vuosi sitten
vanhempi
commit
5d49030717

+ 1 - 0
ActionTowerDefense/Assets/Resources/Prefab/BaGua/Demonic_Giant_Yang.prefab

@@ -719,6 +719,7 @@ MonoBehaviour:
   needToChange: 0
   adsorbSpeed: 0.5
   adsorbTarget: {x: 0, y: 0, z: 0}
+  effectPrefab: {fileID: 0}
 --- !u!54 &5440846222648032765
 Rigidbody:
   m_ObjectHideFlags: 0

+ 1 - 0
ActionTowerDefense/Assets/Resources/Prefab/BaGua/Demonic_Giant_Yin.prefab

@@ -719,6 +719,7 @@ MonoBehaviour:
   needToChange: 0
   adsorbSpeed: 0.5
   adsorbTarget: {x: 0, y: 0, z: 0}
+  effectPrefab: {fileID: 0}
 --- !u!54 &5440846222648032765
 Rigidbody:
   m_ObjectHideFlags: 0

+ 1 - 2
ActionTowerDefense/Assets/Scripts/BaGua/BaGuaTrigger.cs

@@ -43,6 +43,7 @@ public class BaGuaTrigger : MonoBehaviour
                         Giant[0] = foot.baGuaTrigger[i].GetComponentInParent<Demonic>();
                         Giant[1] = GetComponentInParent<Demonic>();
                         Giant[2] = platform.baGuaTrigger[j].GetComponentInParent<Demonic>();
+                        Giant[0].effectPrefab = guaXiangPrefab.Li;
                         for(int k = 0; k < 3; k++)
                         {
                             Giant[k].adsorbTarget = new Vector3(Giant[0].transform.position.x, Giant[k].transform.position.y, Giant[k].transform.position.z);
@@ -62,8 +63,6 @@ public class BaGuaTrigger : MonoBehaviour
                             }
                             Giant[k].ChangeState(CharacterState.BaGua);
                         }
-                        GameObject effect = Instantiate(guaXiangPrefab.Li);
-                        effect.transform.position = Giant[0].transform.position;
                         break;
                     }
                 }

+ 18 - 0
ActionTowerDefense/Assets/Scripts/BaGua/BaGua_LiGua.cs

@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class BaGua_LiGua : MonoBehaviour
+{
+    // Start is called before the first frame update
+    void Start()
+    {
+        
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        
+    }
+}

+ 11 - 0
ActionTowerDefense/Assets/Scripts/BaGua/BaGua_LiGua.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c6a1f6e135f479a4e96903b5855eb3b4
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 2
ActionTowerDefense/Assets/Scripts/Demonic.cs

@@ -32,7 +32,7 @@ public class Demonic : MoveCharacter
     public float adsorbSpeed;                           //八卦吸附的速度
     [HideInInspector]public Vector3 adsorbTarget;       //八卦胖子吸附时目标位置的X
     private float adsorbTime;                           //八卦吸附中的时间
-    
+    public GameObject effectPrefab;                     //八卦卦象效果
 
     private void Awake()
     {
@@ -539,7 +539,7 @@ public class Demonic : MoveCharacter
                 }
                 break;
             case CharacterState.BaGua:
-                if (adsorbTime < 1)
+                if (adsorbTime < 0.5)
                 {
                     adsorbTime += Time.deltaTime * adsorbSpeed;
                     transform.position = Vector3.Lerp(transform.position, adsorbTarget, adsorbTime);
@@ -547,6 +547,12 @@ public class Demonic : MoveCharacter
                 else
                 {
                     transform.position = adsorbTarget;
+                    if (effectPrefab != null)
+                    {
+                        GameObject effect = Instantiate(effectPrefab);
+                        effect.transform.position = transform.position;
+                    }
+                    gameObject.SetActive(false);
                 }
 
                 break;