Browse Source

光球根据胖子数量获得血量

LAPTOP-OM1V99U2\永远de小亡灵 11 tháng trước cách đây
mục cha
commit
af33a6bc31
1 tập tin đã thay đổi với 29 bổ sung9 xóa
  1. 29 9
      ActionTowerDefense/Assets/Scripts/PlayerController.cs

+ 29 - 9
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -164,6 +164,7 @@ public class PlayerController : MoveCharacter
     public ConductReadyTip conductReadyTip; //指挥技就绪
     private bool isReadyConduct;
     public GameObject photosphereObj;
+    public int[] demonicNum;                //JKL召唤的使魔的数量
     
 
     public enum ConductSkills
@@ -397,6 +398,10 @@ public class PlayerController : MoveCharacter
         }
         skeletonMecanim.skeletonDataAsset = playerSpine[playerId];
         demonicDic = new Dictionary<int, List<Demonic>>();
+        for(int i = 0; i < 3; i++)
+        {
+            demonicDic.Add(i, new List<Demonic>());
+        }
         Init();
         spiritSystem = GameObject.Find("SpiritSystem").GetComponent<SpiritSystem>();
     }
@@ -659,20 +664,35 @@ public class PlayerController : MoveCharacter
     {
         if (mp >= conductCostMp[cacheConductId])
         {
-            mp -= conductCostMp[cacheConductId];
-            uiMp.Show(mp, totalMp);
+            bool costMp = true; //如果指挥技能要消耗的使魔数量为0就改成false
             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;
-
+                    if(demonicDic[1].Count > 0)
+                    {
+                        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;
+                        photosphere.hp = demonicDic[1].Count * 1000;
+                    }
+                    else
+                    {
+                        costMp = false;
+                    }
                     break;
             }
+            if (costMp)
+            {
+                mp -= conductCostMp[cacheConductId];
+                uiMp.Show(mp, totalMp);
+            }
+            else
+            {
+                print("使魔不足");
+            }
         }
         else
         {