Files
2023-01-04 17:56:46 +02:00

49 lines
1.3 KiB
C#

using UnityEngine;
public class CrouchState : GroundParentState
{
public override void UpdateLogic(PlayerNetwork player)
{
if (!player.enter)
{
player.enter = true;
player.animationFrames = 0;
}
player.position = new DemonicsVector2(player.position.x, DemonicsPhysics.GROUND_POINT);
CheckFlip(player);
player.canDoubleJump = true;
player.dashFrames = 0;
player.animationFrames = 0;
player.animation = "Crouch";
player.velocity = DemonicsVector2.Zero;
ToIdleState(player);
}
private void ToIdleState(PlayerNetwork player)
{
if (player.direction.y >= 0)
{
player.enter = false;
player.state = "Idle";
}
}
public override void ToAttackState(PlayerNetwork player)
{
player.isCrouch = true;
player.isAir = false;
player.canChainAttack = false;
player.enter = false;
player.state = "Attack";
}
public override void ToArcanaState(PlayerNetwork player)
{
if (player.arcana >= PlayerStatsSO.ARCANA_MULTIPLIER)
{
player.isCrouch = true;
player.isAir = false;
player.canChainAttack = false;
player.enter = false;
player.state = "Arcana";
}
}
}