|
|
@@ -432,22 +432,22 @@ public class Enemy : MoveCharacter
|
|
|
}
|
|
|
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();
|
|
|
- // }
|
|
|
- //}
|
|
|
+ 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;
|
|
|
@@ -709,8 +709,6 @@ public class Enemy : MoveCharacter
|
|
|
break;
|
|
|
case CharacterState.Fall:
|
|
|
rb.velocity = Vector3.zero;
|
|
|
- rb.useGravity = false;
|
|
|
- rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ|RigidbodyConstraints.FreezePositionY;
|
|
|
break;
|
|
|
//case CharacterState.Hurt:
|
|
|
// break;
|
|
|
@@ -818,8 +816,6 @@ public class Enemy : MoveCharacter
|
|
|
break;
|
|
|
case CharacterState.Fall:
|
|
|
aniCollider.Play("Fall", 0, 0);
|
|
|
- rb.useGravity = true;
|
|
|
- rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
|
|
|
break;
|
|
|
case CharacterState.Float:
|
|
|
canMove = false;
|