2022-12-26 03:47:56 +02:00
|
|
|
public class FallState : AirParentState
|
|
|
|
|
{
|
|
|
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
CheckFlip(player);
|
2022-12-29 14:40:06 +02:00
|
|
|
if (!player.enter)
|
|
|
|
|
{
|
|
|
|
|
player.enter = true;
|
2023-04-06 15:16:02 +03:00
|
|
|
player.animation = "Fall";
|
2022-12-29 14:40:06 +02:00
|
|
|
player.animationFrames = 0;
|
2023-04-04 21:43:30 +03:00
|
|
|
return;
|
2022-12-29 14:40:06 +02:00
|
|
|
}
|
2023-07-02 23:17:37 +03:00
|
|
|
player.velocity = new DemonVector2(player.velocity.x, player.velocity.y - DemonicsPhysics.GRAVITY);
|
2023-05-29 11:37:42 +03:00
|
|
|
if (!player.usedShadowbreak)
|
|
|
|
|
base.UpdateLogic(player);
|
|
|
|
|
else
|
|
|
|
|
ToHurtState(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
ToIdleState(player);
|
|
|
|
|
}
|
|
|
|
|
private void ToIdleState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-04-04 21:43:30 +03:00
|
|
|
if (player.position.y <= DemonicsPhysics.GROUND_POINT)
|
2022-12-26 03:47:56 +02:00
|
|
|
{
|
2023-05-29 11:37:42 +03:00
|
|
|
player.usedShadowbreak = false;
|
2022-12-26 03:47:56 +02:00
|
|
|
player.sound = "Landed";
|
2023-11-09 16:57:02 +02:00
|
|
|
player.SetParticle("Fall", new DemonVector2(player.position.x, DemonicsPhysics.GROUND_POINT));
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Idle");
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|