Files

48 lines
1.4 KiB
C#
Raw Normal View History

2022-12-27 13:12:53 +02:00
using UnityEngine;
2022-12-28 14:10:45 +02:00
public class BlockAirState : BlockParentState
2022-12-27 13:12:53 +02:00
{
2022-12-28 14:10:45 +02:00
public override void UpdateLogic(PlayerNetwork player)
2022-12-27 13:12:53 +02:00
{
2022-12-28 14:10:45 +02:00
base.UpdateLogic(player);
player.animation = "BlockAir";
player.animationFrames++;
ToFallState(player);
2023-01-07 23:17:55 +02:00
}
protected override void AfterHitstop(PlayerNetwork player)
{
base.AfterHitstop(player);
2022-12-28 14:10:45 +02:00
ToIdleState(player);
2023-01-07 23:17:55 +02:00
}
private void ToIdleState(PlayerNetwork player)
{
if ((DemonicsFloat)player.position.y <= DemonicsPhysics.GROUND_POINT && (DemonicsFloat)player.velocity.y <= (DemonicsFloat)0 && player.knockback > 1)
{
player.player.StopShakeCoroutine();
if (player.stunFrames <= 0)
{
player.enter = false;
player.state = "Idle";
}
else
{
player.stunFrames = player.attackHurtNetwork.hitStun;
player.velocity = DemonicsVector2.Zero;
player.animationFrames = 0;
player.state = "Block";
}
}
2022-12-28 14:10:45 +02:00
}
private void ToFallState(PlayerNetwork player)
{
if (player.stunFrames <= 0)
{
player.enter = false;
player.state = "Fall";
}
}
protected override void OnEnter(PlayerNetwork player)
2022-12-27 13:12:53 +02:00
{
2022-12-28 14:10:45 +02:00
base.OnEnter(player);
}
}