SZAND\msx_2 1 gadu atpakaļ
vecāks
revīzija
da05b98ca6

+ 5 - 18
ActionTowerDefense/Assets/Scripts/Demonic.cs

@@ -252,7 +252,7 @@ public class Demonic : MoveCharacter
 
     public void AdjustHeight()
     {
-        if (canFly && !isBeDropped)
+        if (canFly)
         {
             if (transform.position.y - flyHeight > 0.1f)
             {
@@ -435,10 +435,7 @@ public class Demonic : MoveCharacter
             case CharacterState.Fall:
                 if (foot.TrigGround || canFly)
                 {
-                    if (!isBeDropped)
-                    {
-                        ChangeState(CharacterState.Idle);
-                    }
+                    ChangeState(CharacterState.Idle);
                     break;
                 }
                 //if (foot.canStepPlayers.Count > 0)
@@ -484,13 +481,10 @@ public class Demonic : MoveCharacter
             //    rb.velocity = vel;
             //    break;
             case CharacterState.Coma:
-                if (!isCaughtByCook)
+                pastComaTime += Time.deltaTime;
+                if (pastComaTime >= comaTime)
                 {
-                    pastComaTime += Time.deltaTime;
-                    if (pastComaTime >= comaTime)
-                    {
-                        ChangeState(CharacterState.Idle);
-                    }
+                    ChangeState(CharacterState.Idle);
                 }
                 break;
             case CharacterState.Attack:
@@ -651,13 +645,6 @@ public class Demonic : MoveCharacter
                 //ani.Play("Coma", 0, 0);
                 ani.Play("idle", 0, 0);
                 aniCollider.Play("Idle", 0, 0);
-                if (isCaughtByCook)
-                {
-                    foreach (GameObject i in HitCols)
-                    {
-                        i.SetActive(false);
-                    }
-                }
                 pastComaTime = 0;
                 rb.velocity = Vector3.zero;
                 break;

+ 12 - 21
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -217,7 +217,7 @@ public class Enemy : MoveCharacter
 
     public void AdjustHeight()
     {
-        if (canFly && !isBeDropped)
+        if (canFly)
         {
             if (transform.position.y - flyHeight > 0.1f)
             {
@@ -400,16 +400,13 @@ public class Enemy : MoveCharacter
             case CharacterState.Fall:
                 if (foot.TrigGround || canFly)
                 {
-                    if (!isBeDropped)
+                    if (isFindingPlayer)
                     {
-                        if (isFindingPlayer)
-                        {
-                            ChangeState(CharacterState.FindPlayer);
-                        }
-                        else
-                        {
-                            ChangeState(CharacterState.Idle);
-                        }
+                        ChangeState(CharacterState.FindPlayer);
+                    }
+                    else
+                    {
+                        ChangeState(CharacterState.Idle);
                     }
                     break;
                 }
@@ -514,13 +511,10 @@ public class Enemy : MoveCharacter
 
                 break;
             case CharacterState.Coma:
-                if (!isCaughtByCook)
+                pastComaTime += Time.deltaTime;
+                if (pastComaTime >= comaTime)
                 {
-                    pastComaTime += Time.deltaTime;
-                    if (pastComaTime >= comaTime)
-                    {
-                        ChangeState(CharacterState.Idle);
-                    }
+                    ChangeState(CharacterState.Idle);
                 }
                 break;
             case CharacterState.FindPlayer:
@@ -801,12 +795,9 @@ public class Enemy : MoveCharacter
                 ani.Play("idle", 0, 0);
                 aniCollider.Play("Idle", 0, 0);
                 rb.velocity = Vector3.zero;
-                if (isCaughtByCook)
+                foreach (GameObject i in HitCols)
                 {
-                    foreach (GameObject i in HitCols)
-                    {
-                        i.SetActive(false);
-                    }
+                    i.SetActive(false);
                 }
                 pastComaTime = 0;
                 break;