Эх сурвалжийг харах

法师变身可自由移动

SZAND\msx_2 1 жил өмнө
parent
commit
e85901e77d

+ 2 - 0
ActionTowerDefense/Assets/Scripts/Bullet.cs

@@ -26,6 +26,8 @@ public class Bullet : MonoBehaviour
     public bool isTrack;
     public Character trackTarget;
 
+    public bool toFloat = false;
+
     private void Awake()
     {
         //owner = GetComponentInParent<Character>();

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

@@ -188,6 +188,7 @@ public class Character : MonoBehaviour
 
     public virtual void AttackShootEvent(int attackId, int shootId)
     {
+        print(1);
         AttackInfo attackInfo;
         if (attackId == 1)
         {

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

@@ -21,6 +21,10 @@ 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()
     {
         
@@ -547,6 +551,18 @@ 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;
+            }
+        }
     }
 
 }

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

@@ -1425,7 +1425,7 @@ public class PlayerController : MoveCharacter
         outlineMats = dem.outlineMats;
         if (dem.canFly)
         {
-            rb.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
+            canfly = true;
         }
         /*  ·¨Ê¦³ö³¡ÊͷŸ¡¿Õ³¡
         if (id == 3)
@@ -1441,7 +1441,7 @@ public class PlayerController : MoveCharacter
         }
         */
         endChange = id + 3;
-        ChangeState(CharacterState.Idle);
+        CheckPlayerChangeState();
     }
 
     public void EndTransfiguration(int id)
@@ -1453,18 +1453,19 @@ public class PlayerController : MoveCharacter
         aniCollider = playerCol;
         bodyTrans = playerTran;
         beSearchTrigger = playerBst;
-        playerBullet = bulletPrefab;
-        playerST = searchTrigger;
-        playerFoot = foot;
-        playerSpinee = spinee;
-        playerMesh = mesh;
-        playerMats = mats;
-        playerOut = outlineMats;
+        bulletPrefab = playerBullet;
+        searchTrigger = playerST;
+        foot = playerFoot;
+        spinee = playerSpinee;
+        mesh = playerMesh;
+        mats = playerMats;
+        outlineMats = playerOut;
         bodyTrans.gameObject.SetActive(true);
         uiHp.gameObject.SetActive(true);
         spiritObj.transform.parent = null;
         spiritObj.SetActive(false);
         Summon(id);
+        CheckPlayerChangeState();
     }
 
     public void Summon(int id)