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)
|
|
|
|
|
{
|
2023-01-20 17:59:16 +02:00
|
|
|
if (player.attackHurtNetwork.knockbackArc > 0 && player.knockback <= 1)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ((DemonicsFloat)player.position.y <= DemonicsPhysics.GROUND_POINT)
|
2023-01-07 23:17:55 +02:00
|
|
|
{
|
|
|
|
|
player.player.StopShakeCoroutine();
|
|
|
|
|
if (player.stunFrames <= 0)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Idle");
|
2023-01-07 23:17:55 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
player.stunFrames = player.attackHurtNetwork.hitStun;
|
|
|
|
|
player.velocity = DemonicsVector2.Zero;
|
|
|
|
|
player.animationFrames = 0;
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Block");
|
2023-01-07 23:17:55 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-12-28 14:10:45 +02:00
|
|
|
}
|
|
|
|
|
private void ToFallState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.stunFrames <= 0)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Fall");
|
2022-12-28 14:10:45 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|