ソースを参照

敌方法师可正常攻击

SZAND\msx_2 1 年間 前
コミット
efa14fe0ae

+ 4 - 4
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Float.prefab

@@ -588,7 +588,7 @@ BoxCollider:
   m_IsTrigger: 1
   m_Enabled: 1
   serializedVersion: 2
-  m_Size: {x: 40, y: 3, z: 1}
+  m_Size: {x: 40, y: 20, z: 1}
   m_Center: {x: 0, y: 0, z: 0}
 --- !u!1 &5388987656270167698
 GameObject:
@@ -1040,9 +1040,9 @@ MonoBehaviour:
   attackType: 1
   bulletPrefab: {fileID: 7473170563405908938, guid: 5a7a8caaf3e79ec4f814d34467f0bf46, type: 3}
   shootPos:
-  - {fileID: 0}
-  - {fileID: 0}
-  - {fileID: 0}
+  - {fileID: 8482269351142858204}
+  - {fileID: 776105162125788029}
+  - {fileID: 6220414675483084992}
   dieKeepTime: 0
   totalDieKeepTime: 2
   attackTarget: {fileID: 0}

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

@@ -588,7 +588,7 @@ BoxCollider:
   m_IsTrigger: 1
   m_Enabled: 1
   serializedVersion: 2
-  m_Size: {x: 40, y: 3, z: 1}
+  m_Size: {x: 40, y: 20, z: 1}
   m_Center: {x: 0, y: 0, z: 0}
 --- !u!1 &5388987656270167698
 GameObject:

+ 9 - 6
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Float.cs

@@ -19,6 +19,8 @@ public class ESpirits_Float : MonoBehaviour
     public float lastTime = 10f;      //漂浮持续时间
     public GameObject fe;            //漂浮脚本
     public GameObject lockEffect;     //锁定特效
+    private GameObject curFe;
+    private GameObject curLock;
 
     private GameObject player1;
     private GameObject player2;
@@ -27,8 +29,9 @@ public class ESpirits_Float : MonoBehaviour
 
     private void Awake()
     {
-        Instantiate(fe, transform.position, new Quaternion(0, 0, 0, 0), transform);
-        Instantiate(lockEffect, new Vector3(0, -50, 0), new Quaternion(0, 0, 0, 0), transform);
+        curFe = Instantiate(fe, transform.position, new Quaternion(0, 0, 0, 0), transform);
+        curFe.GetComponent<FloatEffect>().isEnemy = true;
+        curLock = Instantiate(lockEffect, new Vector3(0, -50, 0), new Quaternion(0, 0, 0, 0), transform);
         lockEffect.SetActive(false);
         player1 = PlayersInput.instance[0].gameObject;
         player2 = PlayersInput.instance[1].gameObject;
@@ -62,14 +65,14 @@ public class ESpirits_Float : MonoBehaviour
 
     private void FollowPlayer()
     {
-        lockEffect.transform.position = target.transform.position;
+        curLock.transform.position = target.transform.position;
     }
 
     public void FloatAttack()
     {
-        fe.transform.position = lockEffect.transform.position;
-        lockEffect.SetActive(false);
-        fe.SetActive(true);
+        curFe.transform.position = lockEffect.transform.position;
+        curLock.SetActive(false);
+        curFe.SetActive(true);
     }
 
     private void Update()