You've already forked Darklings-FightingGame
mirror of
https://github.com/izzy2lost/Darklings-FightingGame.git
synced 2026-03-10 11:35:19 -07:00
78 lines
2.1 KiB
C#
78 lines
2.1 KiB
C#
|
|
using UnityEngine;
|
|
|
|
public class GroundParentState : State
|
|
{
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
{
|
|
base.UpdateLogic(player);
|
|
player.canDoubleJump = true;
|
|
player.canDash = true;
|
|
player.hasJumped = false;
|
|
player.canJump = true;
|
|
ToHurtState(player);
|
|
}
|
|
|
|
public override bool ToBlueFrenzyState(PlayerNetwork player)
|
|
{
|
|
player.enter = false;
|
|
player.state = "BlueFrenzy";
|
|
return true;
|
|
}
|
|
public override bool ToRedFrenzyState(PlayerNetwork player)
|
|
{
|
|
player.enter = false;
|
|
player.state = "RedFrenzy";
|
|
return true;
|
|
}
|
|
private void ToHurtState(PlayerNetwork player)
|
|
{
|
|
if (!player.otherPlayer.canChainAttack && DemonicsCollider.Colliding(player.otherPlayer.hitbox, player.hurtbox))
|
|
{
|
|
player.enter = false;
|
|
player.attackHurtNetwork = player.otherPlayer.attackNetwork;
|
|
if (IsBlocking(player))
|
|
{
|
|
if (player.direction.y < 0)
|
|
{
|
|
player.state = "BlockLow";
|
|
}
|
|
else
|
|
{
|
|
player.state = "Block";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (player.attackHurtNetwork.hardKnockdown)
|
|
{
|
|
player.state = "Airborne";
|
|
}
|
|
else
|
|
{
|
|
if (player.attackHurtNetwork.knockbackArc == 0 || player.attackHurtNetwork.softKnockdown)
|
|
{
|
|
player.state = "Hurt";
|
|
}
|
|
else
|
|
{
|
|
player.state = "HurtAir";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public override bool ToBlockState(PlayerNetwork player, AttackSO attack)
|
|
{
|
|
player.enter = false;
|
|
if (player.direction.y < 0)
|
|
{
|
|
player.state = "BlockLow";
|
|
}
|
|
else
|
|
{
|
|
player.state = "Block";
|
|
}
|
|
return true;
|
|
}
|
|
} |