|
|
@@ -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,6 +709,8 @@ 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;
|
|
|
@@ -816,6 +818,8 @@ 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;
|