Ver Fonte

刺客暂存

LAPTOP-OM1V99U2\永远de小亡灵 há 1 ano atrás
pai
commit
c1c9938dfc

+ 8 - 1
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -444,10 +444,17 @@ public class PlayerController : MoveCharacter
             {
                 //释放技能,此处暂时先写解除变身
                 isUltimate = true;
-                EndTransfiguration(endChange);
+                //EndTransfiguration(endChange);
             }
         }
     }
+    void OnSummonSpirit1Up()
+    {
+        if (isUltimate)
+        {
+            isUltimate = false;
+        }
+    }
     void OnSummonSpirit2()
     {
         if (!isFloat && canMove)

+ 54 - 1
ActionTowerDefense/Assets/Scripts/Spirits/Trans_Assassin.cs

@@ -2,11 +2,23 @@ using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
+public enum Trans_AssassinState
+{
+    Normal = 0,
+    Ready = 1,
+  
+}
 public class Trans_Assassin : MonoBehaviour
 {
     public PlayerController player;
     public float criticalChance;            //±©»÷ÂÊ
     public float criticalMultiplier;        //±©»÷±¶Êý
+    public bool isUltimate;
+    public float distance;
+    public float rushSpeed;
+    public float rushTime;
+    public GameObject aimEffect;
+
     // Start is called before the first frame update
     void Start()
     {
@@ -14,12 +26,25 @@ public class Trans_Assassin : MonoBehaviour
         player.jumpNumber = 3;
         player.criticalChance = criticalChance;
         player.criticalMultiplier = criticalMultiplier;
+        distance = rushSpeed * rushTime * Time.deltaTime;
     }
 
     // Update is called once per frame
     void Update()
     {
-        
+
+        if (isUltimate)
+        {
+            ReadyToDash(player.moveVec);
+        }
+        else
+        {
+            if (player.isUltimate)
+            {
+                isUltimate = true;
+                player.canMove = false;
+            }
+        }
     }
     void Skill()
     {
@@ -30,4 +55,32 @@ public class Trans_Assassin : MonoBehaviour
         player.criticalChance = 0;
 
     }
+    public void ReadyToDash(Vector2 leftDir)
+    {
+        Vector3 targetDir = leftDir.normalized;
+        aimEffect.transform.localScale =
+            new Vector3(distance, 1, 1);
+        float k = Mathf.Atan2(targetDir.y, targetDir.x) * Mathf.Rad2Deg;
+        if (targetDir.x < 0)
+        {
+            aimEffect.transform.rotation = Quaternion.Euler(new Vector3(0, 0, k));
+            if (player.bodyTrans.localScale.x < 0)
+            {
+                player.bodyTrans.localScale =
+                    new Vector3(-player.bodyTrans.localScale.x,player.bodyTrans.localScale.y,
+                    player.bodyTrans.localScale.z);
+            }
+
+        }
+        else
+        {
+            aimEffect.transform.rotation = Quaternion.Euler(new Vector3(0, 0, k));
+            if (player.bodyTrans.localScale.x > 0)
+            {
+                player.bodyTrans.localScale =
+                    new Vector3(-player.bodyTrans.localScale.x,player.bodyTrans.localScale.y,
+                    player.bodyTrans.localScale.z);
+            }
+        }
+    }
 }