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++;
|
2022-12-29 19:32:58 +02:00
|
|
|
player.velocity = new Vector2(player.velocity.x, player.velocity.y - 0.013f);
|
2022-12-28 14:10:45 +02:00
|
|
|
ToFallState(player);
|
|
|
|
|
ToIdleState(player);
|
|
|
|
|
ToBlockState(player);
|
|
|
|
|
}
|
|
|
|
|
private void ToFallState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.stunFrames <= 0)
|
|
|
|
|
{
|
|
|
|
|
player.player.StopShakeCoroutine();
|
|
|
|
|
player.enter = false;
|
|
|
|
|
player.state = "Fall";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ToIdleState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.stunFrames <= 0)
|
|
|
|
|
{
|
|
|
|
|
if ((DemonicsFloat)player.position.y <= DemonicsPhysics.GROUND_POINT && (DemonicsFloat)player.velocity.y <= (DemonicsFloat)0)
|
|
|
|
|
{
|
|
|
|
|
player.player.StopShakeCoroutine();
|
|
|
|
|
player.sound = "Landed";
|
|
|
|
|
player.SetEffect("Fall", player.position);
|
|
|
|
|
player.enter = false;
|
|
|
|
|
player.state = "Idle";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ToBlockState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.stunFrames > 0)
|
|
|
|
|
{
|
|
|
|
|
if ((DemonicsFloat)player.position.y <= DemonicsPhysics.GROUND_POINT && (DemonicsFloat)player.velocity.y <= (DemonicsFloat)0)
|
|
|
|
|
{
|
|
|
|
|
BlockParentState.skipKnockback = true;
|
|
|
|
|
player.player.StopShakeCoroutine();
|
|
|
|
|
player.sound = "Landed";
|
|
|
|
|
player.SetEffect("Fall", player.position);
|
|
|
|
|
player.enter = true;
|
|
|
|
|
player.state = "Block";
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-27 13:12:53 +02:00
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
end = new Vector2(player.position.x + (hurtAttack.knockbackForce.x * -player.flip), player.position.y);
|
2022-12-27 13:12:53 +02:00
|
|
|
}
|
2022-12-28 14:10:45 +02:00
|
|
|
protected override void AfterHitstop(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
base.AfterHitstop(player);
|
|
|
|
|
player.velocity = new Vector2(player.velocity.x, player.velocity.y - 0.013f);
|
|
|
|
|
}
|
|
|
|
|
}
|