2022-12-26 03:47:56 +02:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class AirParentState : State
|
|
|
|
|
{
|
|
|
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
ToHurtState(player);
|
|
|
|
|
ToAttackState(player);
|
2023-01-18 21:41:03 +02:00
|
|
|
ToArcanaState(player);
|
|
|
|
|
ToRedFrenzyState(player);
|
2022-12-31 20:46:52 +02:00
|
|
|
ToDashAirState(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
ToJumpForwardState(player);
|
|
|
|
|
ToJumpState(player);
|
2023-01-14 19:39:35 +02:00
|
|
|
Shadow(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
2023-01-14 19:39:35 +02:00
|
|
|
|
2022-12-26 03:47:56 +02:00
|
|
|
private void ToJumpState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-12-04 02:06:05 +02:00
|
|
|
if (player.canDoubleJump && player.canChainAttack)
|
2022-12-26 03:47:56 +02:00
|
|
|
{
|
|
|
|
|
if (player.direction.y > 0 && !player.hasJumped)
|
|
|
|
|
{
|
|
|
|
|
player.hasJumped = true;
|
|
|
|
|
player.canDoubleJump = false;
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Jump");
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
else if (player.direction.y <= 0 && player.hasJumped)
|
|
|
|
|
{
|
|
|
|
|
player.hasJumped = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ToJumpForwardState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-12-04 02:06:05 +02:00
|
|
|
if (player.canDoubleJump && player.canChainAttack)
|
2022-12-26 03:47:56 +02:00
|
|
|
{
|
|
|
|
|
if (player.direction.y > 0 && player.direction.x != 0 && !player.hasJumped)
|
|
|
|
|
{
|
2022-12-31 20:46:52 +02:00
|
|
|
player.jumpDirection = (int)player.direction.x;
|
2022-12-26 03:47:56 +02:00
|
|
|
player.hasJumped = true;
|
|
|
|
|
player.canDoubleJump = false;
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "JumpForward");
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
else if (player.direction.y <= 0 && player.hasJumped)
|
|
|
|
|
{
|
|
|
|
|
player.hasJumped = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-31 20:46:52 +02:00
|
|
|
private void ToDashAirState(PlayerNetwork player)
|
2022-12-26 03:47:56 +02:00
|
|
|
{
|
2023-07-01 23:48:47 +03:00
|
|
|
if (player.canDoubleJump && player.inputBuffer.CurrentTrigger().pressed)
|
2022-12-26 03:47:56 +02:00
|
|
|
{
|
2023-07-01 23:48:47 +03:00
|
|
|
if (player.inputBuffer.CurrentTrigger().inputEnum == InputEnum.ForwardDash)
|
2023-01-18 21:41:03 +02:00
|
|
|
{
|
|
|
|
|
player.dashDirection = 1;
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "DashAir");
|
2023-01-18 21:41:03 +02:00
|
|
|
}
|
2023-07-01 23:48:47 +03:00
|
|
|
else if (player.inputBuffer.CurrentTrigger().inputEnum == InputEnum.BackDash)
|
2023-01-18 21:41:03 +02:00
|
|
|
{
|
|
|
|
|
player.dashDirection = -1;
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "DashAir");
|
2023-01-18 21:41:03 +02:00
|
|
|
}
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
}
|
2023-01-12 19:12:56 +02:00
|
|
|
private void ToRedFrenzyState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-07-01 23:48:47 +03:00
|
|
|
if (player.inputBuffer.CurrentTrigger().pressed)
|
2023-01-12 19:12:56 +02:00
|
|
|
{
|
2023-01-18 21:41:03 +02:00
|
|
|
RedFrenzy(player);
|
2023-01-12 19:12:56 +02:00
|
|
|
}
|
|
|
|
|
}
|
2023-01-18 21:41:03 +02:00
|
|
|
public bool ToAttackState(PlayerNetwork player)
|
2023-01-06 23:10:53 +02:00
|
|
|
{
|
2023-07-01 23:48:47 +03:00
|
|
|
if (player.inputBuffer.CurrentTrigger().pressed)
|
2023-01-06 23:10:53 +02:00
|
|
|
{
|
|
|
|
|
Attack(player, true);
|
2023-01-19 02:51:24 +02:00
|
|
|
return true;
|
2023-01-06 23:10:53 +02:00
|
|
|
}
|
2023-01-18 21:41:03 +02:00
|
|
|
return false;
|
2023-01-06 23:10:53 +02:00
|
|
|
}
|
2023-01-07 23:17:55 +02:00
|
|
|
public void ToArcanaState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-07-01 23:48:47 +03:00
|
|
|
if (player.inputBuffer.CurrentTrigger().pressed)
|
2023-01-07 23:17:55 +02:00
|
|
|
{
|
|
|
|
|
Arcana(player, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-29 11:37:42 +03:00
|
|
|
protected void ToHurtState(PlayerNetwork player)
|
2023-01-04 17:56:46 +02:00
|
|
|
{
|
2023-08-07 14:03:21 +03:00
|
|
|
if (player.attackHurtNetwork.attackType != AttackTypeEnum.Throw)
|
2023-01-04 17:56:46 +02:00
|
|
|
{
|
2023-08-07 14:03:21 +03:00
|
|
|
if (IsColliding(player))
|
2023-01-04 17:56:46 +02:00
|
|
|
{
|
2023-08-07 14:03:21 +03:00
|
|
|
if (IsBlocking(player))
|
|
|
|
|
EnterState(player, "BlockAir");
|
2023-01-07 23:17:55 +02:00
|
|
|
else
|
|
|
|
|
{
|
2023-08-07 14:03:21 +03:00
|
|
|
if (player.attackHurtNetwork.hardKnockdown || player.attackHurtNetwork.moveName == "Shadowbreak" || player.attackHurtNetwork.softKnockdown && player.position.y > DemonicsPhysics.GROUND_POINT)
|
|
|
|
|
EnterState(player, "Airborne");
|
|
|
|
|
else
|
|
|
|
|
EnterState(player, "HurtAir");
|
2023-01-07 23:17:55 +02:00
|
|
|
}
|
2023-01-04 17:56:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|