Quellcode durchsuchen

enemy中删除刺客冲刺

SZAND\msx_2 vor 7 Monaten
Ursprung
Commit
cd58aebc83

+ 8 - 0
ActionTowerDefense/Assets/Scripts/Characters/AttackController.cs

@@ -0,0 +1,8 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class AttackController : MonoBehaviour
+{
+    
+}

+ 11 - 0
ActionTowerDefense/Assets/Scripts/Characters/AttackController.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 565fb65a48a8ef648b3096d46e15efd9
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 3 - 7
ActionTowerDefense/Assets/Scripts/Characters/Character.cs

@@ -13,7 +13,7 @@ public enum CharacterState
     Run = 2,
     Rise = 3,               //空中上升
     Fall = 4,               //空中下落
-    //Hurt = 5,
+
     Attack = 6,
     KeepAttack = 7,
     Summon = 8,
@@ -21,14 +21,10 @@ public enum CharacterState
     Sprint = 10,
     Die = 11,
     Weak = 12,
-    PullRope = 13,
+
     Spirits = 14,           //召唤英灵
     Float = 15,             //空中漂浮
-    FindPlayer = 16,        //寻找玩家
-    ReadyToRush = 17,       //瞄准准备冲刺
-    ReadyToDownRush = 18,   //准备落地冲刺
-    DownRush = 19,          //落地冲刺
-    FinishRush = 20,        //结束冲刺
+
     Coma = 21,              //昏迷
     RushAttack = 22,        //带攻击的冲刺
     Transfiguration = 23,   //变身

+ 0 - 3
ActionTowerDefense/Assets/Scripts/Characters/Demonic.cs

@@ -48,9 +48,6 @@ public class Demonic : MoveCharacter
     public bool upFirstAfterWeaknessOrNot;  //虚弱结束后是否先升高
 
     public bool isBeBlownUp;    //被击飞
-    private void Awake()
-    {
-    }
 
     private void Start()
     {

+ 2 - 334
ActionTowerDefense/Assets/Scripts/Characters/Enemy.cs

@@ -70,43 +70,8 @@ public class Enemy : MoveCharacter
     public int dropSoulMin = 1;
     public float dropSoulAngle = 60f;
 
-    [Header("冲刺攻击")]
-    public GameObject aimEffect;
-    public DashEffect dashEffect;
-
-    [HideInInspector]
-    public bool noOnSearchState;
-    [HideInInspector]
-    public bool isFindingPlayer;
-    [HideInInspector]
-    public bool isFindPlayer;
-
-    public float hateDistance;
-    [HideInInspector]
-    public float distance;
-    [HideInInspector]
-    public Vector3 rushEndPos;
-
-    public float aimDistance;
-    public float rushTime;
-    public float rushSpeed;
-    [HideInInspector]
-    public float time;
-    public float readyCD;
-
-    [HideInInspector]
-    public Vector3 targetDir;
-    public bool haveDownRush;   //冲刺结束后是否可以接落地斩
-    public bool rushHaveAttack; //冲刺是否带伤害
-    public float downRushTime;
-    public float finishRushTime;
-
     [Header("验证功能开关")]
     public bool upFirstAfterWeaknessOrNot;  //虚弱结束后是否先升高
-    private void Awake()
-    {
-        aimDistance = rushTime * rushSpeed / 2;
-    }
 
     private void Start()
     {
@@ -136,11 +101,7 @@ public class Enemy : MoveCharacter
 
     public override void FixedUpdate()
     {
-        if (!noOnSearchState)
-        {
-            OnSearchState();
-
-        }
+        OnSearchState();
         OnState();
     }
 
@@ -434,11 +395,7 @@ public class Enemy : MoveCharacter
             case CharacterState.Fall:
                 if (foot.TrigGround || canFly)
                 {
-                    if (isFindingPlayer)
-                    {
-                        ChangeState(CharacterState.FindPlayer);
-                    }
-                    else if (willBeComa)
+                    if (willBeComa)
                     {
                         comaTime = willComaTime;
                         ChangeState(CharacterState.Coma);
@@ -596,136 +553,6 @@ public class Enemy : MoveCharacter
                     ChangeState(CharacterState.Idle);
                 }
                 break;
-            case CharacterState.FindPlayer:
-                if (!isFindPlayer)
-                {
-                    if (!foot.TrigGround && !canFly)
-                    {
-                        if (rb.velocity.y > 0)
-                        {
-                            ChangeState(CharacterState.Rise);
-                            break;
-                        }
-                        else
-                        {
-                            ChangeState(CharacterState.Fall);
-                            break;
-                        }
-                    }
-                    if (targetCharacter == null)
-                    {
-                        ChosePlayer();
-                        if (targetCharacter == null)
-                        {
-                            ChangeState(CharacterState.FinishRush);
-                            time = finishRushTime;
-                            break;
-                        }
-                    }
-                    else
-                    {
-                        if (targetCharacter.isRevive ||
-                            targetCharacter.GetComponent<PlayerController>().isBaseBtnOut)
-                        {
-                            targetCharacter = null;
-                            break;
-                        }
-                    }
-                    if (Mathf.Abs(transform.position.x - targetCharacter.transform.position.x)
-                        < hateDistance)
-                    {
-                        rushEndPos = targetCharacter.transform.position;
-                        isFindPlayer = true;
-                        break;
-                    }
-                    if (targetCharacter.transform.position.x > transform.position.x)
-                    {
-                        rb.velocity = Vector3.right * moveSpeed;
-                        if (bodyTrans.localScale.x > 0)
-                        {
-                            Turn();
-                        }
-                    }
-                    if (targetCharacter.transform.position.x < transform.position.x)
-                    {
-                        rb.velocity = Vector3.left * moveSpeed;
-                        if (bodyTrans.localScale.x < 0)
-                        {
-                            Turn();
-                        }
-                    }
-                }
-
-                break;
-            case CharacterState.ReadyToRush:
-                time += Time.deltaTime;
-
-                if (time >= readyCD)
-                {
-                    time = 0;
-                    if (rushHaveAttack)
-                    {
-                        ChangeState(CharacterState.RushAttack);
-                    }
-                    else
-                    {
-                        ChangeState(CharacterState.Rush);
-                    }
-
-                }
-                break;
-            case CharacterState.RushAttack:
-                time += Time.deltaTime;
-                dashEffect.canHit = true;
-                Rush();
-                if (time >= rushTime)
-                {
-                    time = 0;
-                    if (haveDownRush)
-                    {
-                        if (foot.TrigGround)
-                        {
-                            ChangeState(CharacterState.FinishRush);
-                        }
-                        else
-                        {
-                            ChangeState(CharacterState.ReadyToDownRush);
-                        }
-                    }
-                    else
-                    {
-                        ChangeState(CharacterState.FinishRush);
-                    }
-                }
-                break;
-            case CharacterState.ReadyToDownRush:
-                time += Time.deltaTime;
-                if (time >= downRushTime)
-                {
-                    time = 0;
-                    ChangeState(CharacterState.DownRush);
-                }
-                break;
-            case CharacterState.DownRush:
-
-                if (transform.position.y > 0)
-                {
-                    dashEffect.canHit = true;
-                    Rush();
-                }
-                if (foot.TrigGround || transform.position.y <= -1)
-                {
-                    ChangeState(CharacterState.FinishRush);
-                }
-                break;
-            case CharacterState.FinishRush:
-                time += Time.deltaTime;
-                if (time > finishRushTime)
-                {
-                    time = 0;
-                    ChangeState(CharacterState.Idle);
-                }
-                break;
             default:
                 break;
         }
@@ -787,54 +614,6 @@ public class Enemy : MoveCharacter
                 }
                 canMove = true;
                 break;
-            case CharacterState.FindPlayer:
-                noOnSearchState = false;
-                rb.velocity = Vector3.zero;
-                isFindPlayer = false;
-                break;
-            case CharacterState.ReadyToRush:
-                time = 0;
-
-                aimEffect.SetActive(false);
-                aimEffect.transform.localScale = Vector3.zero;
-                rb.constraints =
-                    RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation;
-                break;
-            case CharacterState.RushAttack:
-                time = 0;
-                dashEffect.canHit = false;
-                rb.velocity = Vector3.zero;
-                bodyTrans.rotation = Quaternion.Euler(Vector3.zero);
-
-                break;
-            case CharacterState.ReadyToDownRush:
-                time = 0;
-                rb.constraints =
-                    RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation;
-
-                break;
-            case CharacterState.DownRush:
-
-                dashEffect.canHit = false;
-                rb.velocity = Vector3.zero;
-                bodyTrans.rotation = Quaternion.Euler(Vector3.zero);
-                if (foot.trigGroundList.Count == 0)
-                {
-                    transform.position = new Vector3(transform.position.x, -1, 0);
-                }
-                else
-                {
-                    transform.position = new Vector3(transform.position.x,
-                        foot.trigGroundList[0].transform.position.y, 0);
-                }
-                break;
-            case CharacterState.FinishRush:
-                time = 0;
-
-                searchState = SearchState.NoTarget;
-                noOnSearchState = false;
-                ani.Play("idle", 0, 0);
-                break;
             default:
                 break;
         }
@@ -883,10 +662,6 @@ public class Enemy : MoveCharacter
             case CharacterState.Weak:
                 switch (oldState)
                 {
-                    case CharacterState.ReadyToRush:
-                    case CharacterState.RushAttack:
-                    case CharacterState.ReadyToDownRush:
-                    case CharacterState.DownRush:
                     case CharacterState.Rush:
                         state = oldState;
                         beRepelValue = totalBeRepelValue;
@@ -904,50 +679,6 @@ public class Enemy : MoveCharacter
                         break;
                 }
                 break;
-            case CharacterState.FindPlayer:
-                isFindPlayer = false;
-                isFindingPlayer = true;
-                noOnSearchState = true;
-                ChosePlayer();
-                ani.Play("walk", 0, 0);
-                break;
-            case CharacterState.ReadyToRush:
-                time = 0;
-                canNotChangeHurt = true;
-                ani.Play("charge", 0, 0);
-                aimEffect.SetActive(true);
-                rb.constraints = RigidbodyConstraints.FreezeAll;
-                ReadyToDash(rushEndPos + Vector3.up, transform.position + Vector3.up);
-
-                break;
-            case CharacterState.RushAttack:
-
-                targetDir =
-                        (rushEndPos - transform.position).normalized;
-                ani.Play("rush_attack", 0, 0);
-                break;
-            case CharacterState.ReadyToDownRush:
-                time = 0;
-                rb.constraints = RigidbodyConstraints.FreezeAll;
-                ani.Play("charge", 0, 0);
-                break;
-            case CharacterState.DownRush:
-                time = 0;
-                targetDir = Vector3.down;
-                ani.Play("rush_attack", 0, 0);
-                break;
-            case CharacterState.FinishRush:
-                time = 0;
-                if (oldState == CharacterState.DownRush)
-                {
-                    ani.Play("fall_end", 0, 0);
-                }
-                else
-                {
-                    ani.Play("idle", 0, 0);
-                }
-                canNotChangeHurt = false;
-                break;
             default:
                 break;
         }
@@ -1158,8 +889,6 @@ public class Enemy : MoveCharacter
                 player0.beTargetCharacter.Add(this);
             }
 
-            distance = distance0;
-
         }
         else
         {
@@ -1168,67 +897,6 @@ public class Enemy : MoveCharacter
             {
                 player1.beTargetCharacter.Add(this);
             }
-
-            distance = distance1;
-        }
-    }
-    public void ReadyToDash(Vector3 pos0, Vector3 pos1)
-    {
-        Vector3 target = (pos0 - pos1).normalized;
-        float distance = aimDistance;
-        aimEffect.transform.localScale =
-            new Vector3(distance, 1, 1);
-
-        targetDir = pos0 - pos1;
-        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 (bodyTrans.localScale.x < 0)
-            {
-                bodyTrans.localScale =
-                    new Vector3(-bodyTrans.localScale.x, bodyTrans.localScale.y, bodyTrans.localScale.z);
-            }
-
-        }
-        else
-        {
-            aimEffect.transform.rotation = Quaternion.Euler(new Vector3(0, 0, k));
-            if (bodyTrans.localScale.x > 0)
-            {
-                bodyTrans.localScale =
-                    new Vector3(-bodyTrans.localScale.x, bodyTrans.localScale.y, bodyTrans.localScale.z);
-            }
         }
     }
-
-    private void Rush()
-    {
-        float k = Mathf.Atan2(targetDir.y, targetDir.x) * Mathf.Rad2Deg;
-        if (targetDir.x < 0)
-        {
-            dashEffect.offset = 1;
-            if (bodyTrans.localScale.x < 0)
-            {
-                bodyTrans.localScale =
-                    new Vector3(-bodyTrans.localScale.x, bodyTrans.localScale.y, bodyTrans.localScale.z);
-            }
-
-            bodyTrans.rotation = Quaternion.Euler(new Vector3(0, 0, k - 180));
-        }
-        else
-        {
-            if (bodyTrans.localScale.x > 0)
-            {
-                bodyTrans.localScale =
-                    new Vector3(-bodyTrans.localScale.x, bodyTrans.localScale.y, bodyTrans.localScale.z);
-            }
-
-            dashEffect.offset = -1;
-            bodyTrans.rotation = Quaternion.Euler(new Vector3(0, 0, k));
-        }
-
-
-        rb.velocity = targetDir * rushSpeed;
-    }
 }

+ 0 - 3
ActionTowerDefense/Assets/Scripts/Characters/PlayerController.cs

@@ -1640,9 +1640,6 @@ public class PlayerController : MoveCharacter
                     ChangeState(CharacterState.Idle);
                     break;
                 }
-                break;
-            case CharacterState.PullRope:
-
                 break;
             case CharacterState.Conduct:
                 if (CheckConduct())

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Assassin.cs

@@ -14,7 +14,7 @@ public class ESpirits_Assassin : MonoBehaviour
     public float attackCD;
     public AssassinState state;
     public Enemy enemy;
-    
+    /*
     private void Update()
     {
         if (enemy.floatState == 0)
@@ -68,5 +68,5 @@ public class ESpirits_Assassin : MonoBehaviour
                 break;
         }
     }
-
+    */
 }

+ 0 - 1
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Cook.cs

@@ -48,7 +48,6 @@ public class ESpirits_Cook : MonoBehaviour
         dia = text.transform.parent.gameObject;
         destX = DestinationX();
         text.text = chuan.ToString();
-        ene.noOnSearchState = true;
         dia.SetActive(false);
     }