Files

27 lines
783 B
C#
Raw Normal View History

2022-12-26 03:47:56 +02:00
using UnityEngine;
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;
player.animationFrames = 0;
}
2022-12-26 03:47:56 +02:00
player.animation = "Fall";
2022-12-31 20:46:52 +02:00
player.velocity = new DemonicsVector2(player.velocity.x, player.velocity.y - DemonicsPhysics.GRAVITY);
2022-12-26 03:47:56 +02:00
base.UpdateLogic(player);
ToIdleState(player);
}
private void ToIdleState(PlayerNetwork player)
{
2023-01-19 02:51:24 +02:00
if ((DemonicsFloat)player.position.y <= DemonicsPhysics.GROUND_POINT)
2022-12-26 03:47:56 +02:00
{
player.sound = "Landed";
player.SetEffect("Fall", player.position);
2023-01-23 18:31:58 +02:00
EnterState(player, "Idle");
2022-12-26 03:47:56 +02:00
}
}
}