LAPTOP-OM1V99U2\永远de小亡灵 1 жил өмнө
parent
commit
ffe60e44e9

+ 10 - 4
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Assassin.prefab

@@ -183,7 +183,7 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   time: 0
   attackCD: 5
-  readyCD: 1
+  readyCD: 2
   hateDistance: 10
   state: 0
   enemy: {fileID: -677743004047987606}
@@ -194,6 +194,9 @@ MonoBehaviour:
   offset: 2
   targetDir: {x: 0, y: 0, z: 0}
   dashTime: 0.8
+  downTime: 0.8
+  finishTime: 0.8
+  body: {fileID: 5216717017252562314}
 --- !u!54 &2437299196472462355
 Rigidbody:
   m_ObjectHideFlags: 0
@@ -209,7 +212,7 @@ Rigidbody:
   m_IsKinematic: 0
   m_Interpolate: 0
   m_Constraints: 120
-  m_CollisionDetection: 0
+  m_CollisionDetection: 1
 --- !u!114 &-677743004047987606
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -248,7 +251,7 @@ MonoBehaviour:
   attack2Infos:
   - damage: 50
     attackDir: {x: -1, y: 0, z: 0}
-    force: 1000
+    force: 100
     changeHurt: 0
     repelValue: 50
   attackTriggers:
@@ -291,6 +294,7 @@ MonoBehaviour:
   maxRotateSpeed: 20
   minRotateSpeed: 5
   floatTime: 20
+  floatState: 0
   outlineMats:
   - {fileID: 2100000, guid: eb0e26c1a9cf9a14799273e742b98d21, type: 2}
   id: 0
@@ -298,6 +302,8 @@ MonoBehaviour:
   searchState: 0
   attackDistance: 1.5
   canFly: 0
+  flyHeight: 0
+  flyUpSpeed: 10
   attackRatio: 0
   maxMoveSpeed: 30
   minMoveSpeed: 30
@@ -350,7 +356,7 @@ BoxCollider:
   m_IsTrigger: 1
   m_Enabled: 1
   serializedVersion: 2
-  m_Size: {x: 0.52, y: 0.003, z: 1}
+  m_Size: {x: 0.8, y: 0.003, z: 1}
   m_Center: {x: -0.035, y: 0, z: 0}
 --- !u!114 &2437299196663985756
 MonoBehaviour:

+ 54 - 12
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Assassin.cs

@@ -8,7 +8,9 @@ public enum AssassinState
     FindPlayer = 1, //寻找主角位置
     ReadyToDash = 2,  //准备攻击主角
     Dash = 3,   //向主角方向冲刺
-    Down = 4,   //落地斩
+    ReadyToDown = 4,    //准备落地斩
+    Down = 5,   //落地斩
+    Finish = 6, //结束冲刺
 }
 public class ESpirits_Assassin : MonoBehaviour
 {
@@ -28,6 +30,9 @@ public class ESpirits_Assassin : MonoBehaviour
     [HideInInspector]
     public Vector3 targetDir;
     public float dashTime;
+    public float downTime;
+    public float finishTime;
+    public GameObject body;
     private void Update()
     {
 
@@ -51,14 +56,13 @@ public class ESpirits_Assassin : MonoBehaviour
                 break;
             case AssassinState.FindPlayer:
                 ChosePlayer();
-                if (distance <= hateDistance)
+                if (distance < hateDistance)
                 {
-                    state = AssassinState.ReadyToDash;
+                    
                     enemy.ChangeState(CharacterState.Rush);
                     rb.velocity = Vector3.zero;
                     enemy.ani.Play("hitted", 0, 0);
-                    enemy.aniCollider.Play("Hurt", 0, 0);
-
+                    state = AssassinState.ReadyToDash;
                 }
                 break;
             case AssassinState.ReadyToDash:
@@ -84,22 +88,53 @@ public class ESpirits_Assassin : MonoBehaviour
                     if (enemy.foot.TrigGround)
                     {
 
-                        dashEffect.isDashAttack = false;
-                        state = AssassinState.Normal;
-                        enemy.isSpiritsAttack = false;
-                        enemy.searchState = SearchState.NoTarget;
-                        enemy.ChangeState(CharacterState.Idle);
+                        enemy.ani.Play("idle", 0, 0);
+                        state = AssassinState.Finish;
                     }
                     else
                     {
-                        state = AssassinState.Down;
+                        rb.constraints = RigidbodyConstraints.FreezeAll;
+                        enemy.ani.Play("hitted", 0, 0);
+                        state = AssassinState.ReadyToDown;
                     }
 
 
+                }
+                break;
+            case AssassinState.ReadyToDown:
+                time += Time.deltaTime;
+                rb.velocity = Vector3.zero;
+                if(time >= downTime)
+                {
+                    time = 0;
+                    rb.constraints = 
+                        RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation;
+                    targetDir = Vector3.down;
+                    enemy.ani.Play("attack_summon", 0, 0);
+                    state = AssassinState.Down;
                 }
                 break;
             case AssassinState.Down:
-
+                Dash();
+                if (enemy.foot.TrigGround)
+                {
+                    body.transform.rotation = Quaternion.Euler(Vector3.zero);
+                    
+                    
+                    enemy.ani.Play("idle", 0, 0);
+                    state = AssassinState.Finish;
+                }
+                break;
+            case AssassinState.Finish:
+                time += Time.deltaTime;
+                if(time > finishTime)
+                {
+                    dashEffect.isDashAttack = false;
+                    enemy.isSpiritsAttack = false;
+                    enemy.searchState = SearchState.NoTarget;
+                    enemy.ChangeState(CharacterState.Idle);
+                    state = AssassinState.Normal;
+                }
                 break;
         }
     }
@@ -131,14 +166,21 @@ public class ESpirits_Assassin : MonoBehaviour
     }
     private void Dash()
     {
+        float k = Mathf.Atan2(targetDir.y, targetDir.x)*Mathf.Rad2Deg;
         if (targetDir.x < 0)
         {
             dashEffect.offset = offset;
+            body.transform.localScale = new Vector3(1, 1, 1);
+            body.transform.rotation = Quaternion.Euler(new Vector3(0, 0, k-180));
         }
         else
         {
             dashEffect.offset = -offset;
+            body.transform.localScale = new Vector3(-1, 1, 1);
+            body.transform.rotation = Quaternion.Euler(new Vector3(0, 0, k));
         }
+        
+        
         rb.velocity = targetDir * moveSpeed;
     }
 }