Browse Source

漂浮可以配置手柄按键了

SZAND\msx_2 1 năm trước cách đây
mục cha
commit
636d20ce29

+ 1 - 1
ActionTowerDefense/Assets/Resources/Prefab/Spirits_Float.prefab

@@ -208,7 +208,7 @@ GameObject:
   - component: {fileID: 5032495223408797810}
   - component: {fileID: 8046884224131155322}
   - component: {fileID: 3000999671257713975}
-  m_Layer: 7
+  m_Layer: 0
   m_Name: EffectCollider
   m_TagString: Untagged
   m_Icon: {fileID: 0}

+ 1 - 1
ActionTowerDefense/Assets/Scripts/Spirits/Spirits.cs

@@ -12,7 +12,7 @@ public class Spirits : MonoBehaviour
         Invisible = 3,  //ÒþÉí
     }
 
-    public SpiritType currentSpirit;
+    public SpiritType currentSpirit = SpiritType.Float;
 
 
     public void SummonSpirit(SpiritType st)

+ 6 - 1
ActionTowerDefense/Assets/Scripts/Spirits/Spirits_Float.cs

@@ -17,13 +17,18 @@ public class Spirits_Float : MonoBehaviour
         body = transform.parent.parent.parent.gameObject;
         origPos = body.transform.position;
         curHeight = origPos.y;
+        Invoke("disappear", 0.2f);
+    }
+
+    private void disappear()
+    {
+        GetComponent<Collider>().enabled = false;
     }
 
     private void OnTriggerEnter(Collider other)
     {
         if (other.gameObject.layer == 8)
         {
-            print(1);
             GameObject ga = other.transform.parent.parent.parent.gameObject;
             ga.GetComponent<Enemy>().FloatStateOn();
         }