Browse Source

在光球存在的时候不能使用光球指挥技

LAPTOP-OM1V99U2\永远de小亡灵 11 tháng trước cách đây
mục cha
commit
89f14faeed

+ 2 - 0
ActionTowerDefense/Assets/Resources/Prefab/Player.prefab

@@ -773,6 +773,7 @@ MonoBehaviour:
   searchTrigger: {fileID: 2246792914537570827}
   bodyCollider: {fileID: 458160094715212641}
   uiHp: {fileID: 205997967}
+  beHitTrigger: {fileID: 0}
   state: 1
   totalHp: 5000
   hp: 0
@@ -997,6 +998,7 @@ MonoBehaviour:
   - 0
   - 0
   conductSkills: 000000000000000000000000
+  conductCanRelease: 010101
   conductReadyTip: {fileID: 946637326309089849}
   photosphereObj: {fileID: 256012001268456902, guid: ba2e5bcb5c7ac604ea72b2fcb544a3cb, type: 3}
   isClickBtnJump: 0

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

@@ -30,7 +30,7 @@ public class AttackTrigger : MonoBehaviour
         if (photosphere && Util.CheckCanHit(owner.tag, "Player"))
         {
             isInVain = true;
-            photosphere.Reflex(owner.beHitTrigger);
+            photosphere.Reflex(owner.beHitTrigger, damage);
             return;
         }
         BeHitTrigger hitTrigger = other.GetComponent<BeHitTrigger>();

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

@@ -136,7 +136,7 @@ public class Bullet : MonoBehaviour
         if (photosphere && Util.CheckCanHit(owner.tag, "Player"))
         {
             isInVain = true;
-            photosphere.Reflex(owner.beHitTrigger);
+            photosphere.Reflex(owner.beHitTrigger, damage);
             gameObject.SetActive(false);
             return;
         }

+ 11 - 2
ActionTowerDefense/Assets/Scripts/Conduct/Photosphere.cs

@@ -4,19 +4,28 @@ using UnityEngine;
 
 public class Photosphere : MonoBehaviour
 {
+    public PlayerController owner;
+    public int conductId;
     public float stayTime;
     private float time;
+    public int hp;
     private void Update()
     {
         time += Time.deltaTime;
         if (time >= stayTime)
         {
+            owner.conductCanRelease[conductId] = true;
             gameObject.SetActive(false);
         }
     }
 
-    public void Reflex(BeHitTrigger beHitTrigger)
+    public void Reflex(BeHitTrigger beHitTrigger,int damage)
     {
-        print("reflex");
+        hp -= damage;
+        if (hp <= 0)
+        {
+            owner.conductCanRelease[conductId] = true;
+            gameObject.SetActive(false);
+        }
     }
 }

+ 24 - 12
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -160,6 +160,7 @@ public class PlayerController : MoveCharacter
     [Header("指挥相应时间")] [Tooltip("在此时间以外松手为指挥")] public float[] canConductTime;
     [Header("指挥相应耗蓝")] [Tooltip("输入相应的技能耗蓝")] public float[] conductCostMp;
     [Header("指挥技能")] [Tooltip("选择相应的指挥技能")] public ConductSkills[] conductSkills;
+    [Header("指挥技能否释放")] [Tooltip("针对前一次技能效果还没有结束,此次技能不能使用的情况")] public bool[] conductCanRelease;
     public ConductReadyTip conductReadyTip; //指挥技就绪
     private bool isReadyConduct;
     public GameObject photosphereObj;
@@ -611,12 +612,6 @@ public class PlayerController : MoveCharacter
 
     public bool CheckSummon()
     {
-        if (state!=CharacterState.Conduct && nowConductButton != -1 && conductTime >= 0)
-        {
-            CheckTurn();
-            ChangeState(CharacterState.Conduct);
-            return true;
-        }
         if (isBtnEastUp || isBtnWestUp || isBtnSouthUp)
         {
             if (cacheSummonTime >= 0 && conductTime <= totalCacheSummonTime)
@@ -627,16 +622,23 @@ public class PlayerController : MoveCharacter
                 return true;
             }
         }
+        if (state!=CharacterState.Conduct && nowConductButton != -1 && conductTime >= 0)
+        {
+            if (!conductCanRelease[nowConductButton])
+            {
+                cacheConductId = nowConductButton;
+                nowConductButton = -1;
+                return false;
+            }
+            CheckTurn();
+            ChangeState(CharacterState.Conduct);
+            return true;
+        }
         return false;
     }
 
     public bool CheckConduct()
     {
-        if(!isReadyConduct && conductTime >= canConductTime[nowConductButton])
-        {
-            conductReadyTip.Show();
-            isReadyConduct = true;
-        }
         if (isBtnEastUp || isBtnWestUp || isBtnSouthUp)
         {
             if (isReadyConduct)
@@ -646,6 +648,12 @@ public class PlayerController : MoveCharacter
             isReadyConduct = false;
             return true;
         }
+        if (!isReadyConduct && conductTime >= canConductTime[nowConductButton])
+        {
+            conductReadyTip.Show();
+            isReadyConduct = true;
+        }
+
         return false;
     }
 
@@ -658,9 +666,13 @@ public class PlayerController : MoveCharacter
             switch (conductSkills[cacheConductId])
             {
                 case ConductSkills.Photosphere:
-
+                    conductCanRelease[cacheConductId] = false;
                     GameObject obj = GameObject.Instantiate(photosphereObj,transform);
                     obj.transform.position = transform.position + Vector3.up;
+                    Photosphere photosphere = obj.GetComponent<Photosphere>();
+                    photosphere.owner = this;
+                    photosphere.conductId = cacheConductId;
+
                     break;
             }
         }