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;
|
|
|
|
|
player.animationFrames = 0;
|
|
|
|
|
}
|
2022-12-31 20:46:52 +02:00
|
|
|
player.position = new DemonicsVector2(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;
|
|
|
|
|
player.animation = "Crouch";
|
2022-12-31 20:46:52 +02:00
|
|
|
player.velocity = DemonicsVector2.Zero;
|
2023-01-07 23:17:55 +02:00
|
|
|
base.UpdateLogic(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
ToIdleState(player);
|
2023-01-05 16:37:41 +02:00
|
|
|
ToAttackState(player);
|
2023-01-07 23:17:55 +02:00
|
|
|
ToArcanaState(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ToIdleState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.direction.y >= 0)
|
|
|
|
|
{
|
2022-12-29 21:24:36 +02:00
|
|
|
player.enter = false;
|
2022-12-26 03:47:56 +02:00
|
|
|
player.state = "Idle";
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-01-06 23:10:53 +02:00
|
|
|
public void ToAttackState(PlayerNetwork player)
|
2022-12-26 03:47:56 +02:00
|
|
|
{
|
2023-01-07 23:17:55 +02:00
|
|
|
if (player.attackPress)
|
2023-01-05 16:37:41 +02:00
|
|
|
{
|
2023-01-06 23:10:53 +02:00
|
|
|
Attack(player);
|
2023-01-05 16:37:41 +02:00
|
|
|
}
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
2023-01-07 23:17:55 +02:00
|
|
|
public void ToArcanaState(PlayerNetwork player)
|
2022-12-26 03:47:56 +02:00
|
|
|
{
|
2023-01-07 23:17:55 +02:00
|
|
|
if (player.arcanaPress)
|
2023-01-04 17:56:46 +02:00
|
|
|
{
|
2023-01-07 23:17:55 +02:00
|
|
|
Arcana(player);
|
2023-01-04 17:56:46 +02:00
|
|
|
}
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
}
|