2022-12-26 03:47:56 +02:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ArcanaState : State
|
|
|
|
|
{
|
|
|
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
|
|
|
{
|
2022-12-27 17:24:54 +02:00
|
|
|
AttackSO attack = PlayerComboSystem.GetComboAttack(player.playerStats, InputEnum.Special, player.isCrouch, player.isAir);
|
2022-12-26 03:47:56 +02:00
|
|
|
if (!player.enter)
|
|
|
|
|
{
|
|
|
|
|
player.enter = true;
|
2022-12-27 13:12:53 +02:00
|
|
|
player.canChainAttack = false;
|
2022-12-26 03:47:56 +02:00
|
|
|
GameplayManager.Instance.PlayerOne.CurrentAttack = attack;
|
|
|
|
|
player.animation = attack.name;
|
|
|
|
|
player.sound = attack.attackSound;
|
|
|
|
|
player.animationFrames = 0;
|
|
|
|
|
player.attackFrames = DemonicsAnimator.GetMaxAnimationFrames(player.playerStats._animation, player.animation);
|
|
|
|
|
player.velocity = new Vector2(attack.travelDistance.x * player.flip, attack.travelDistance.y);
|
|
|
|
|
}
|
|
|
|
|
ToIdleState(player);
|
|
|
|
|
if (GameSimulation.Hitstop <= 0)
|
|
|
|
|
{
|
2022-12-27 13:12:53 +02:00
|
|
|
if (attack.travelDistance.y > 0)
|
|
|
|
|
{
|
|
|
|
|
player.velocity = new Vector2(player.velocity.x, player.velocity.y - player.gravity);
|
|
|
|
|
ToIdleFallState(player);
|
|
|
|
|
}
|
2022-12-26 03:47:56 +02:00
|
|
|
player.animationFrames++;
|
|
|
|
|
player.attackFrames--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ToIdleFallState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if ((DemonicsFloat)player.position.y <= DemonicsPhysics.GROUND_POINT && (DemonicsFloat)player.velocity.y <= (DemonicsFloat)0)
|
|
|
|
|
{
|
|
|
|
|
player.isCrouch = false;
|
|
|
|
|
player.isAir = false;
|
|
|
|
|
player.attackInput = InputEnum.Direction;
|
|
|
|
|
player.enter = false;
|
|
|
|
|
player.state = "Idle";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ToIdleState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.attackFrames <= 0)
|
|
|
|
|
{
|
|
|
|
|
player.enter = false;
|
|
|
|
|
if (player.isAir)
|
|
|
|
|
{
|
|
|
|
|
player.isCrouch = false;
|
|
|
|
|
player.isAir = false;
|
|
|
|
|
player.attackInput = InputEnum.Direction;
|
|
|
|
|
player.state = "Fall";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
player.isCrouch = false;
|
|
|
|
|
player.isAir = false;
|
|
|
|
|
player.attackInput = InputEnum.Direction;
|
|
|
|
|
player.state = "Idle";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|