Files

29 lines
861 B
C#
Raw Normal View History

2022-12-29 14:40:06 +02:00
public class GrabState : State
{
public override void UpdateLogic(PlayerNetwork player)
{
if (!player.enter)
{
2023-01-10 18:39:07 +02:00
SetTopPriority(player);
CheckFlip(player);
2022-12-29 14:40:06 +02:00
player.enter = true;
2023-01-15 13:05:14 +02:00
player.hitbox.enter = false;
2022-12-29 14:40:06 +02:00
player.animationFrames = 0;
2023-01-10 18:39:07 +02:00
player.animation = "Grab";
player.sound = "Hit";
player.attackFrames = DemonicsAnimator.GetMaxAnimationFrames(player.playerStats._animation, player.animation);
2022-12-29 14:40:06 +02:00
}
2023-01-10 18:39:07 +02:00
player.velocity = DemonicsVector2.Zero;
2022-12-29 14:40:06 +02:00
player.animationFrames++;
2023-01-10 18:39:07 +02:00
player.attackFrames--;
ToIdleState(player);
}
private void ToIdleState(PlayerNetwork player)
{
if (player.attackFrames <= 0)
{
player.enter = false;
player.state = "Idle";
}
2022-12-29 14:40:06 +02:00
}
}