2022-12-26 03:47:56 +02:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class CrouchState : GroundParentState
|
|
|
|
|
{
|
|
|
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
|
|
|
{
|
2022-12-30 14:07:58 +02:00
|
|
|
if (!player.enter)
|
|
|
|
|
{
|
|
|
|
|
player.enter = true;
|
2023-04-04 21:43:30 +03:00
|
|
|
player.animation = "Crouch";
|
2022-12-30 14:07:58 +02:00
|
|
|
player.animationFrames = 0;
|
2023-04-04 21:43:30 +03:00
|
|
|
return;
|
2022-12-30 14:07:58 +02:00
|
|
|
}
|
2023-07-02 23:17:37 +03:00
|
|
|
player.position = new DemonVector2(player.position.x, DemonicsPhysics.GROUND_POINT);
|
2022-12-30 02:51:24 +02:00
|
|
|
CheckFlip(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
player.canDoubleJump = true;
|
|
|
|
|
player.dashFrames = 0;
|
|
|
|
|
player.animationFrames = 0;
|
2023-07-02 23:17:37 +03:00
|
|
|
player.velocity = DemonVector2.Zero;
|
2023-01-07 23:17:55 +02:00
|
|
|
base.UpdateLogic(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
ToIdleState(player);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ToIdleState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.direction.y >= 0)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Idle");
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|