Bläddra i källkod

修复变身后只能释放一次攻击的bug

SZAND\msx_2 1 år sedan
förälder
incheckning
1665a84148

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

@@ -968,6 +968,8 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   controller: {fileID: 0}
+  minTime: 7
+  maxTime: 9
 --- !u!114 &3290368322717680010
 MonoBehaviour:
   m_ObjectHideFlags: 0

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

@@ -290,7 +290,7 @@ public class Character : MonoBehaviour
             default:
                 break;
         }
-        ChangeState(CharacterState.Attack);
+        //ChangeState(CharacterState.Attack);
     }
 
     public void SetSortingOrder(int order)

+ 0 - 16
ActionTowerDefense/Assets/Scripts/Demonic.cs

@@ -21,10 +21,6 @@ public class Demonic : MoveCharacter
     public int playerID;
     public bool hasEffect = false;
 
-    private bool isFloat;   //俺是法师
-    private bool isFirst = true;   //第一次攻击
-    private int times;      //第几次attack2攻击了
-
     private void Awake()
     {
         
@@ -551,18 +547,6 @@ public class Demonic : MoveCharacter
     {
         base.Attack2();
         attackTarget = targetCharacter;
-        if (isFloat)
-        {
-            if (!isFirst)
-            {
-                times += 1;
-            }
-            if(isFirst || times >= 7 || times == 9)
-            {
-                isFirst = false;
-                //bulletPrefab.GetComponent<Bullet>().toFloat = true;
-            }
-        }
     }
 
 }

+ 18 - 0
ActionTowerDefense/Assets/Scripts/Spirits/Trans_Float.cs

@@ -6,6 +6,10 @@ public class Trans_Float : MonoBehaviour
 {
     public PlayerController controller;
 
+    private bool isFirst;           //第一次攻击
+    private int times;              //攻击次数
+    public int minTime, maxTime;   //保底范围
+
     private void Start()
     {
         controller = GetComponentInParent<PlayerController>();
@@ -16,6 +20,20 @@ public class Trans_Float : MonoBehaviour
         if (controller.isinputJ)
         {
             controller.isinputJ = false;
+            if (isFirst)
+            {
+                isFirst = false;
+                //触发
+            }
+            else
+            {
+                times += 1;
+                if (times >= minTime || times == maxTime)
+                {
+                    times = 0;
+                    //触发
+                }
+            }
             GetComponent<Demonic>().Attack2();
         }
         if (controller.isinputK)