Files
David Kalatzis 9297c6f2bb Minor update
2023-01-23 18:31:58 +02:00

27 lines
783 B
C#

using UnityEngine;
public class FallState : AirParentState
{
public override void UpdateLogic(PlayerNetwork player)
{
CheckFlip(player);
if (!player.enter)
{
player.enter = true;
player.animationFrames = 0;
}
player.animation = "Fall";
player.velocity = new DemonicsVector2(player.velocity.x, player.velocity.y - DemonicsPhysics.GRAVITY);
base.UpdateLogic(player);
ToIdleState(player);
}
private void ToIdleState(PlayerNetwork player)
{
if ((DemonicsFloat)player.position.y <= DemonicsPhysics.GROUND_POINT)
{
player.sound = "Landed";
player.SetEffect("Fall", player.position);
EnterState(player, "Idle");
}
}
}