1243896040 2 долоо хоног өмнө
parent
commit
74bec76939

+ 2 - 1
ActionTowerDefense/Assets/Resources/Prefab/Enemy/Enemy_Catninja_Far.prefab

@@ -362,6 +362,7 @@ MonoBehaviour:
   Attack_summonShootCanTransmit: 0
   Attack_summonShootCanTransmit: 0
   debugAttackFrom: 0
   debugAttackFrom: 0
   hitResistance: 0
   hitResistance: 0
+  bc: {fileID: 0}
   foot: {fileID: 2437299196663985756}
   foot: {fileID: 2437299196663985756}
   attributeStatus: {fileID: 0}
   attributeStatus: {fileID: 0}
   hitFeedbackSystem: {fileID: 0}
   hitFeedbackSystem: {fileID: 0}
@@ -435,7 +436,7 @@ MonoBehaviour:
   dropProbability: 100
   dropProbability: 100
   dropSoulAngle: 90
   dropSoulAngle: 90
   jumpForce: 18
   jumpForce: 18
-  minDistance: 15
+  minDistance: 20
   moveDir: {x: 0, y: 0, z: 0}
   moveDir: {x: 0, y: 0, z: 0}
 --- !u!114 &3190768326954873711
 --- !u!114 &3190768326954873711
 MonoBehaviour:
 MonoBehaviour:

+ 19 - 1
ActionTowerDefense/Assets/Scripts/Characters/Enemy.cs

@@ -439,7 +439,25 @@ public class Enemy : MoveCharacter
                         ChangeState(CharacterState.Fall);
                         ChangeState(CharacterState.Fall);
                         break;
                         break;
                     }
                     }
-                    rb.velocity += Vector3.up * extraRiseGravity * Time.deltaTime * moveSpeedScale;
+                    velocity.y += extraRiseGravity * Time.deltaTime;
+                    if (leftDir.x > 0.3f)
+                    {
+                        velocity.x = moveSpeed;
+                        if (bodyTrans.localScale.x > 0)
+                        {
+                            Turn();
+                        }
+                    }
+                    else if (leftDir.x < -0.3f)
+                    {
+                        velocity.x = -moveSpeed;
+                        if (bodyTrans.localScale.x < 0)
+                        {
+                            Turn();
+                        }
+                    }
+
+                    rb.velocity = velocity * moveSpeedScale;
                 }
                 }
                 break;
                 break;
             case CharacterState.Fall:
             case CharacterState.Fall:

+ 2 - 0
ActionTowerDefense/Assets/Scripts/Enemy/Catninja_Far.cs

@@ -17,6 +17,7 @@ public class Catninja_Far : Enemy
         {
         {
             case CharacterState.Idle:
             case CharacterState.Idle:
                 ChangeMoveDir(true);
                 ChangeMoveDir(true);
+                Debug.Log(moveDir);
                 ChangeState(CharacterState.Rise);
                 ChangeState(CharacterState.Rise);
                 Vector3 velocity = rb.velocity;
                 Vector3 velocity = rb.velocity;
                 velocity.y = jumpForce;
                 velocity.y = jumpForce;
@@ -80,6 +81,7 @@ public class Catninja_Far : Enemy
                     if (Mathf.Abs(targetCharacter.transform.position.x - transform.position.x) < minDistance)
                     if (Mathf.Abs(targetCharacter.transform.position.x - transform.position.x) < minDistance)
                     {
                     {
                         //moveDir.x = -moveDir.x;
                         //moveDir.x = -moveDir.x;
+                        CheckTurn(moveDir.x);
                         moveDir.x = 0;
                         moveDir.x = 0;
                     }
                     }
                     break;
                     break;