SZAND\msx_2 1 рік тому
батько
коміт
4b9e47efe2

+ 5 - 2
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Cook.prefab

@@ -339,6 +339,8 @@ MonoBehaviour:
   larger: 1.2
   canMove: 0
   lockEffect: {fileID: 2123904437201259524, guid: 24cf2b33715a9e04b9aabcb789c31067, type: 3}
+  cookKillEffect: {fileID: 0}
+  cookTime: 0.967
 --- !u!1 &3483054690158852324
 GameObject:
   m_ObjectHideFlags: 0
@@ -888,8 +890,8 @@ MonoBehaviour:
   flyHeight: 0
   flyUpSpeed: 10
   attackRatio: 0
-  maxMoveSpeed: 15
-  minMoveSpeed: 15
+  maxMoveSpeed: 3
+  minMoveSpeed: 3
   dropSoul: 3
   soulPrefab: {fileID: 1723151111827507807, guid: e2b65aa482f2f1447a4074208d72b778, type: 3}
   soulStartSpeed: 1
@@ -911,6 +913,7 @@ MonoBehaviour:
   haveDownRush: 0
   downRushTime: 0.8
   finishRushTime: 0.8
+  isBack: 0
 --- !u!1 &6026815487321357762
 GameObject:
   m_ObjectHideFlags: 0

+ 6 - 1
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -65,6 +65,7 @@ public class Enemy : MoveCharacter
     public bool haveDownRush;
     public float downRushTime;
     public float finishRushTime;
+    public bool isBack = false; //Íù·´·½Ïò×ß
 
     private void Awake()
     {
@@ -144,7 +145,11 @@ public class Enemy : MoveCharacter
                     break;
             }
         }
-        return moveDir;
+        if (!isBack)
+        {
+            return moveDir;
+        }
+        return -moveDir;
     }
 
     public bool GetAttack()

+ 37 - 10
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Cook.cs

@@ -39,7 +39,6 @@ public class ESpirits_Cook : MonoBehaviour
     private int count;              //顾客数量
 
     public float larger;            //顾客变大的程度
-    public bool canMove = false;    //厨师可移动
 
     private GameObject player1;
     private GameObject player2;
@@ -47,6 +46,10 @@ public class ESpirits_Cook : MonoBehaviour
 
     public GameObject lockEffect;
     private GameObject curLock;
+    //public GameObject cookKillEffect;
+
+    private float pastTime;
+    public float cookTime;
 
     public enum cookState
     {
@@ -92,7 +95,7 @@ public class ESpirits_Cook : MonoBehaviour
                     ca.HpUp(value, larger);
                     customers[count] = ga;
                     count += 1;
-                    Instantiate(effect, ga.transform.position, new Quaternion(0, 0, 0, 0), ga.transform);
+                    //Instantiate(effect, ga.transform.position, new Quaternion(0, 0, 0, 0), ga.transform);
                     if (chuan == 0)
                     {
                         toCatch = true;
@@ -106,8 +109,22 @@ public class ESpirits_Cook : MonoBehaviour
         {
             if (other.gameObject.layer == 7 || other.gameObject.layer == 6)
             {
-                food = other.gameObject;
-                ChangeState(cookState.cook);
+                food = other.transform.parent.parent.parent.gameObject;
+                if (food.layer == 7 && !food.GetComponent<Demonic>().isDie)
+                {
+                    print(11111111);
+                    food.GetComponent<Demonic>().ChangeState(CharacterState.Die);
+                    //cookKillEffect.SetActive(true);
+                    ChangeState(cookState.cook);
+                    print(22222222);
+                }
+                else if (food.layer == 6 && !food.GetComponent<Demonic>().isDie)
+                {
+                    food.GetComponent<PlayerController>().ChangeState(CharacterState.Die);
+                    //cookKillEffect.SetActive(true);
+                    ChangeState(cookState.cook);
+                    print(state);
+                }
             }
         }
     }
@@ -118,7 +135,7 @@ public class ESpirits_Cook : MonoBehaviour
         {
             //卖串中
             case cookState.sell:
-                canMove = false;
+                ene.isBack = false;
                 //不能被攻击
                 foreach (GameObject g in colliders)
                 {
@@ -127,7 +144,6 @@ public class ESpirits_Cook : MonoBehaviour
                 break;
             //走路中
             case cookState.walk:
-                canMove = true;
                 dia.SetActive(false);
                 //能被攻击
                 foreach (GameObject g in colliders)
@@ -139,11 +155,11 @@ public class ESpirits_Cook : MonoBehaviour
                 break;
             //发现目标
             case cookState.find:
+                ene.ChangeState(CharacterState.FindPlayer);
                 break;
 
             //冲刺中
             case cookState.run:
-                canMove = true;
                 foreach (GameObject g in colliders)
                 {
                     g.SetActive(true);
@@ -151,9 +167,13 @@ public class ESpirits_Cook : MonoBehaviour
                 break;
             //鲨人中
             case cookState.cook:
+                ani.Play("attack_march", 0, 0);
+                ene.canMove = false;
                 break;
             //返回中
             case cookState.back:
+                ene.canMove = true;
+                ene.isBack = true;
                 break;
             default:
                 break;
@@ -187,15 +207,22 @@ public class ESpirits_Cook : MonoBehaviour
         switch (cs)
         {
             case cookState.walk:
-                
                 break;
             case cookState.find:
+                if (ene.isFindPlayer)
+                {
+                    ene.ChangeState(CharacterState.ReadyToRush);
+                }
                 break;
             case cookState.back:
                 break;
-
             case cookState.cook:
-
+                pastTime += Time.deltaTime;
+                if (pastTime >= cookTime)
+                {
+                    pastTime = 0;
+                    ChangeState(cookState.back);
+                }
                 break;
             case cookState.run:
                 ene.targetCharacter = target.GetComponent<Character>();