You've already forked Darklings-FightingGame
mirror of
https://github.com/izzy2lost/Darklings-FightingGame.git
synced 2026-03-10 11:35:19 -07:00
116 lines
3.4 KiB
C#
116 lines
3.4 KiB
C#
using UnityEngine;
|
|
|
|
public class AirParentState : State
|
|
{
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
{
|
|
ToDashAirState(player);
|
|
ToJumpForwardState(player);
|
|
ToJumpState(player);
|
|
ToHurtState(player);
|
|
ToRedFrenzyState(player);
|
|
ToAttackState(player);
|
|
ToArcanaState(player);
|
|
}
|
|
private void ToJumpState(PlayerNetwork player)
|
|
{
|
|
if (player.canDoubleJump)
|
|
{
|
|
if (player.direction.y > 0 && !player.hasJumped)
|
|
{
|
|
player.enter = false;
|
|
player.hasJumped = true;
|
|
player.canDoubleJump = false;
|
|
player.state = "Jump";
|
|
}
|
|
else if (player.direction.y <= 0 && player.hasJumped)
|
|
{
|
|
player.hasJumped = false;
|
|
}
|
|
}
|
|
}
|
|
private void ToJumpForwardState(PlayerNetwork player)
|
|
{
|
|
if (player.canDoubleJump)
|
|
{
|
|
if (player.direction.y > 0 && player.direction.x != 0 && !player.hasJumped)
|
|
{
|
|
player.jumpDirection = (int)player.direction.x;
|
|
player.enter = false;
|
|
player.hasJumped = true;
|
|
player.canDoubleJump = false;
|
|
player.state = "JumpForward";
|
|
}
|
|
else if (player.direction.y <= 0 && player.hasJumped)
|
|
{
|
|
player.hasJumped = false;
|
|
}
|
|
}
|
|
}
|
|
private void ToDashAirState(PlayerNetwork player)
|
|
{
|
|
if (player.dashDirection != 0 && player.canDash)
|
|
{
|
|
player.enter = false;
|
|
player.velocity = DemonicsVector2.Zero;
|
|
player.state = "DashAir";
|
|
}
|
|
}
|
|
public override bool ToBlockState(PlayerNetwork player, AttackSO attack)
|
|
{
|
|
player.enter = false;
|
|
player.state = "BlockAir";
|
|
return true;
|
|
}
|
|
private void ToRedFrenzyState(PlayerNetwork player)
|
|
{
|
|
if (player.redFrenzyPress && player.healthRecoverable > player.health)
|
|
{
|
|
AttackSO attack = PlayerComboSystem.GetRedFrenzy(player.playerStats);
|
|
SetAttack(player, attack);
|
|
player.enter = false;
|
|
player.state = "RedFrenzy";
|
|
}
|
|
}
|
|
public void ToAttackState(PlayerNetwork player)
|
|
{
|
|
if (player.attackPress)
|
|
{
|
|
Attack(player, true);
|
|
}
|
|
}
|
|
public void ToArcanaState(PlayerNetwork player)
|
|
{
|
|
if (player.arcanaPress)
|
|
{
|
|
Arcana(player, true);
|
|
}
|
|
}
|
|
private void ToHurtState(PlayerNetwork player)
|
|
{
|
|
if (player.otherPlayer.attackNetwork.attackType == AttackTypeEnum.Throw)
|
|
{
|
|
return;
|
|
}
|
|
if (!player.otherPlayer.canChainAttack && IsColliding(player))
|
|
{
|
|
player.enter = false;
|
|
player.attackHurtNetwork = player.otherPlayer.attackNetwork;
|
|
if (IsBlocking(player))
|
|
{
|
|
player.state = "BlockAir";
|
|
}
|
|
else
|
|
{
|
|
if (player.attackHurtNetwork.hardKnockdown || player.attackHurtNetwork.softKnockdown && (DemonicsFloat)player.position.y > DemonicsPhysics.GROUND_POINT)
|
|
{
|
|
player.state = "Airborne";
|
|
}
|
|
else
|
|
{
|
|
player.state = "HurtAir";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |