Prechádzať zdrojové kódy

法师变身技能耗蓝

SZAND\msx_2 1 rok pred
rodič
commit
9c9a2a8a2a

+ 4 - 0
ActionTowerDefense/Assets/Resources/Prefab/Transfiguration/Trans_Float.prefab

@@ -1032,6 +1032,9 @@ MonoBehaviour:
   controller: {fileID: 0}
   changeTime: 30
   UIoffset: {x: 0, y: 0, z: 0}
+  mpJ: 10
+  mpK: 40
+  mpL: 100
   intervalTime: 0.5
   minTime: 7
   maxTime: 9
@@ -1040,6 +1043,7 @@ MonoBehaviour:
   fe: {fileID: 417478504669294145, guid: 243eb0eff66414445990654286d861d1, type: 3}
   moveSpeed: 0.05
   keepFloatTime: 5
+  LAttackDamage: 100
 --- !u!114 &3290368322717680010
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 65 - 32
ActionTowerDefense/Assets/Scripts/Spirits/Trans_Float.cs

@@ -8,6 +8,10 @@ public class Trans_Float : MonoBehaviour
     public float changeTime;
     public Vector3 UIoffset;                //UI调整值
 
+    public int mpJ;
+    public int mpK;
+    public int mpL;
+
     public float intervalTime;              //攻击硬直
     private float pastAttackTime;
     private bool canAttack = true;
@@ -32,6 +36,8 @@ public class Trans_Float : MonoBehaviour
     public float keepFloatTime;             //K键最大持续时间
     private float pastTime;
 
+    public float LAttackDamage;             //L键摔落伤害
+
     private void Start()
     {
         controller = GetComponentInParent<PlayerController>();
@@ -57,51 +63,69 @@ public class Trans_Float : MonoBehaviour
         }
         if (controller.isinputJ && canAttack)
         {
-            canAttack = false;
-            controller.isinputJ = false;
-            if (isFirst)
+            if (controller.mp >= mpJ)
             {
-                if (!dem.attackToFloat)
+                controller.mp -= mpJ;
+                controller.uiMp.Show(controller.mp, controller.totalMp);
+                canAttack = false;
+                controller.isinputJ = false;
+                if (isFirst)
                 {
-                    isFirst = false;
-                    dem.attackToFloat = true;
+                    if (!dem.attackToFloat)
+                    {
+                        isFirst = false;
+                        dem.attackToFloat = true;
+                    }
                 }
-            }
-            else
-            {
-                if (!dem.attackToFloat)
+                else
                 {
-                    times += 1;
-                    if (times >= minTime || times == maxTime)
+                    if (!dem.attackToFloat)
                     {
-                        times = 0;
-                        dem.attackToFloat = true;
+                        times += 1;
+                        if (times >= minTime || times == maxTime)
+                        {
+                            times = 0;
+                            dem.attackToFloat = true;
+                        }
                     }
                 }
+                dem.Attack2();
+            }
+            else
+            {
+                Debug.Log("mp不足");
             }
-            dem.Attack2();
         }
         if (controller.isinputK)
         {
-            pastTime += Time.deltaTime;
-            controller.canMove = false;
-            controller.ChangeState(CharacterState.Idle);
-            //controller.rb.velocity = new Vector3(0, 0, 0);
-            if (!once)
+            if (controller.mp >= mpK)
             {
-                isK = true;
-                once = true;
-                curlock.transform.position = transform.position;
-                curlock.SetActive(true);
+                pastTime += Time.deltaTime;
+                controller.canMove = false;
+                controller.ChangeState(CharacterState.Idle);
+                //controller.rb.velocity = new Vector3(0, 0, 0);
+                if (!once)
+                {
+                    isK = true;
+                    once = true;
+                    curlock.transform.position = transform.position;
+                    curlock.SetActive(true);
+                }
+                curlock.transform.position += new Vector3(controller.moveVec.x, 0, 0) * moveSpeed;
+                if (pastTime >= keepFloatTime)
+                {
+                    controller.isinputK = false;
+                }
             }
-            curlock.transform.position += new Vector3(controller.moveVec.x, 0, 0) * moveSpeed;
-            if (pastTime >= keepFloatTime)
+            else
             {
-                controller.isinputK = false;
+                Debug.Log("mp不足");
             }
         }
         if(isK && !controller.isinputK)
         {
+            controller.mp -= mpK;
+            controller.uiMp.Show(controller.mp, controller.totalMp);
             pastTime = 0;
             isK = false;
             controller.canMove = true;
@@ -113,15 +137,24 @@ public class Trans_Float : MonoBehaviour
         }
         if (controller.isinputL)
         {
-            controller.isinputL = false;
-            foreach(MoveCharacter f in FloatData.eneIsFloating)
+            if (controller.mp >= mpL)
             {
-                if (f.isFloat)
+                controller.mp -= mpL;
+                controller.uiMp.Show(controller.mp, controller.totalMp);
+                controller.isinputL = false;
+                foreach (MoveCharacter f in FloatData.eneIsFloating)
                 {
-                    f.FloatDrop();
-                    FloatData.Clear(1);
+                    if (f.isFloat)
+                    {
+                        f.FloatDrop();
+                        FloatData.Clear(1);
+                    }
                 }
             }
+            else
+            {
+                Debug.Log("mp不足");
+            }
         }
     }
 }