Selaa lähdekoodia

厨师将是否吃过这家串的逻辑从厨师记录顾客改为顾客记录厨师

SZAND\msx_2 1 vuosi sitten
vanhempi
commit
19e018a4c9

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

@@ -46,6 +46,7 @@ public enum HpUpType
 public class Character : MonoBehaviour
 {
     public int cookNum;   //콘隣뜩�눔
+    public List<GameObject> cooks;  //넜법强소돨눔
 
     public SkeletonMecanim mecanim;
     public Skeleton skeleton;

+ 20 - 17
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -85,25 +85,28 @@ public class MoveCharacter : Character
 
     public void FloatStateOn()
     {
-        ChangeMat(0);
-        curTime = 0;
-        if (floatState == 0)
+        if (canMove)
         {
-            origPos = transform.position;
-            curHeight = origPos.y;
-        }
-        origPos.x = transform.position.x;
-        ChangeState(CharacterState.Rise);
-        floatState = 1;
-        riseTime = Random.Range(minTime, maxTime);
-        backSpeed = Random.Range(1, 4);
-        if (gameObject.tag == "Enemy" || gameObject.tag == "Player")
-        {
-            backSpeed = -backSpeed;
+            ChangeMat(0);
+            curTime = 0;
+            if (floatState == 0)
+            {
+                origPos = transform.position;
+                curHeight = origPos.y;
+            }
+            origPos.x = transform.position.x;
+            ChangeState(CharacterState.Rise);
+            floatState = 1;
+            riseTime = Random.Range(minTime, maxTime);
+            backSpeed = Random.Range(1, 4);
+            if (gameObject.tag == "Enemy" || gameObject.tag == "Player")
+            {
+                backSpeed = -backSpeed;
+            }
+            rotateSpeed = Random.Range(minRotateSpeed, maxRotateSpeed);
+            rotateDir = (1.5f - Random.Range(1, 3)) * 2;
+            height = Random.Range(minHeight, maxHeight);
         }
-        rotateSpeed = Random.Range(minRotateSpeed, maxRotateSpeed);
-        rotateDir = (1.5f - Random.Range(1, 3)) * 2;
-        height = Random.Range(minHeight, maxHeight);
     }
 
     private void RotateSelf()

+ 5 - 6
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Cook.cs

@@ -36,8 +36,7 @@ public class ESpirits_Cook : MonoBehaviour
     public float activeAniTime;     //厨子出现动画的时长
     private bool isAct = false;     //厨子已经完整出现
 
-    private List<GameObject> customers; //厨子的所有顾客
-    private int count;              //顾客数量
+    //private List<GameObject> customers; //厨子的所有顾客
 
     public float larger;            //顾客变大的程度
 
@@ -77,7 +76,7 @@ public class ESpirits_Cook : MonoBehaviour
         col.enabled = false;
         dia = text.transform.parent.gameObject;
         dia.SetActive(false);
-        customers = new List<GameObject>();
+        //customers = new List<GameObject>();
         destX = DestinationX();
         text.text = chuan.ToString();
         //curLock = Instantiate(lockEffect, cook.transform.position, new Quaternion(0, 0, 0, 0), cook.transform);
@@ -98,14 +97,14 @@ public class ESpirits_Cook : MonoBehaviour
             {
                 GameObject ga = other.transform.parent.parent.parent.gameObject;
                 Character ca = ga.GetComponent<Character>();
-                if (!customers.Exists(T => T == ga))
+                if (!ca.cooks.Exists(T => T == gameObject))
                 {
                     chuan -= 1;
                     text.text = chuan.ToString();
                     ani.Play("attack_march", 0, 0);
                     ca.HpUp(value, larger);
-                    customers.Add(ga);
-                    count += 1;
+                    ca.cooks.Add(gameObject);
+                    //count += 1;
                     //Instantiate(effect, ga.transform.position, new Quaternion(0, 0, 0, 0), ga.transform);
                     if (chuan == 0)
                     {