|
|
@@ -481,24 +481,32 @@ public class Demonic : MoveCharacter
|
|
|
ChangeState(CharacterState.Idle);
|
|
|
break;
|
|
|
}
|
|
|
- velocity.y += extraFallGravity * Time.deltaTime;
|
|
|
- if (leftDir.x > 0.3f)
|
|
|
+ if (canFly && isDie)
|
|
|
{
|
|
|
- velocity.x = moveSpeed;
|
|
|
- if (bodyTrans.localScale.x > 0)
|
|
|
- {
|
|
|
- Turn();
|
|
|
- }
|
|
|
+ velocity.y += extraFallGravity * Time.deltaTime;
|
|
|
+ rb.velocity = velocity;
|
|
|
}
|
|
|
- else if (leftDir.x < -0.3f)
|
|
|
+ else
|
|
|
{
|
|
|
- velocity.x = -moveSpeed;
|
|
|
- if (bodyTrans.localScale.x < 0)
|
|
|
+ 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)
|
|
|
{
|
|
|
- Turn();
|
|
|
+ velocity.x = -moveSpeed;
|
|
|
+ if (bodyTrans.localScale.x < 0)
|
|
|
+ {
|
|
|
+ Turn();
|
|
|
+ }
|
|
|
}
|
|
|
+ rb.velocity = velocity;
|
|
|
}
|
|
|
- rb.velocity = velocity;
|
|
|
break;
|
|
|
case CharacterState.Attack:
|
|
|
attackController.JudgeTriggerOnOff();
|
|
|
@@ -710,8 +718,12 @@ public class Demonic : MoveCharacter
|
|
|
case CharacterState.Attack:
|
|
|
break;
|
|
|
case CharacterState.Die:
|
|
|
- if (canFly && !isDie)
|
|
|
+ if (canFly)
|
|
|
{
|
|
|
+ if (isDie)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
|
|
|
rb.velocity = Vector3.zero;
|
|
|
ChangeState(CharacterState.Fall);
|