|
|
@@ -309,12 +309,7 @@ public class Enemy : MoveCharacter
|
|
|
}
|
|
|
if (leftDir.x > 0.3f)
|
|
|
{
|
|
|
- //rb.velocity += Vector3.right * moveAcc * Time.deltaTime;
|
|
|
rb.velocity = Vector3.right * moveSpeed;
|
|
|
- //if (rb.velocity.x > maxMoveSpeed)
|
|
|
- //{
|
|
|
- // rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
- //}
|
|
|
if (bodyTrans.localScale.x > 0)
|
|
|
{
|
|
|
Turn();
|
|
|
@@ -322,12 +317,7 @@ public class Enemy : MoveCharacter
|
|
|
}
|
|
|
else if (leftDir.x < -0.3f)
|
|
|
{
|
|
|
- //rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
|
|
|
rb.velocity = Vector3.left * moveSpeed;
|
|
|
- //if (rb.velocity.x < -maxMoveSpeed)
|
|
|
- //{
|
|
|
- // rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
- //}
|
|
|
if (bodyTrans.localScale.x < 0)
|
|
|
{
|
|
|
Turn();
|
|
|
@@ -408,7 +398,26 @@ public class Enemy : MoveCharacter
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
- rb.velocity += Vector3.up * extraFallGravity * Time.deltaTime;
|
|
|
+ Vector3 velocity = rb.velocity;
|
|
|
+ velocity.y += extraFallGravity * 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;
|
|
|
break;
|
|
|
case CharacterState.Attack:
|
|
|
if (attackTime <= 0)
|