2022-12-26 03:47:56 +02:00
|
|
|
|
2022-12-26 21:22:49 +02:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
2022-12-26 03:47:56 +02:00
|
|
|
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;
|
2023-01-09 18:16:00 +02:00
|
|
|
ToBlueFrenzyState(player);
|
|
|
|
|
ToRedFrenzyState(player);
|
2023-01-10 18:39:07 +02:00
|
|
|
ToGrabState(player);
|
2023-01-18 21:41:03 +02:00
|
|
|
ToAttackState(player);
|
|
|
|
|
ToArcanaState(player);
|
2023-01-14 19:39:35 +02:00
|
|
|
Shadow(player);
|
2023-01-23 18:31:58 +02:00
|
|
|
ToHurtState(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
2023-01-04 17:56:46 +02:00
|
|
|
|
2023-01-09 18:16:00 +02:00
|
|
|
private void ToBlueFrenzyState(PlayerNetwork player)
|
2022-12-29 14:40:06 +02:00
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
if (player.inputBuffer.CurrentInput().pressed && player.inputBuffer.CurrentInput().inputEnum == InputEnum.Parry)
|
2023-01-09 18:16:00 +02:00
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "BlueFrenzy");
|
2023-01-09 18:16:00 +02:00
|
|
|
}
|
2022-12-29 14:40:06 +02:00
|
|
|
}
|
2023-01-18 21:41:03 +02:00
|
|
|
public void ToAttackState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
if (player.inputBuffer.CurrentInput().pressed)
|
2023-01-18 21:41:03 +02:00
|
|
|
{
|
|
|
|
|
Attack(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void ToArcanaState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
if (player.inputBuffer.CurrentInput().pressed)
|
2023-01-18 21:41:03 +02:00
|
|
|
{
|
|
|
|
|
Arcana(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-01-09 18:16:00 +02:00
|
|
|
private void ToRedFrenzyState(PlayerNetwork player)
|
2022-12-29 14:40:06 +02:00
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
if (player.inputBuffer.CurrentInput().pressed)
|
2023-01-09 18:16:00 +02:00
|
|
|
{
|
2023-01-18 21:41:03 +02:00
|
|
|
RedFrenzy(player);
|
2023-01-09 18:16:00 +02:00
|
|
|
}
|
2022-12-29 14:40:06 +02:00
|
|
|
}
|
2023-01-10 18:39:07 +02:00
|
|
|
private void ToGrabState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
if (player.inputBuffer.CurrentInput().pressed && player.inputBuffer.CurrentInput().inputEnum == InputEnum.Throw)
|
2023-01-10 18:39:07 +02:00
|
|
|
{
|
|
|
|
|
AttackSO attack = PlayerComboSystem.GetThrow(player.playerStats);
|
2023-01-15 13:05:14 +02:00
|
|
|
player.attackNetwork = SetAttack(player.attackInput, attack);
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Grab");
|
2023-01-10 18:39:07 +02:00
|
|
|
}
|
|
|
|
|
}
|
2023-01-23 18:31:58 +02:00
|
|
|
private void ToHurtState(PlayerNetwork player)
|
2022-12-29 14:40:06 +02:00
|
|
|
{
|
2023-01-14 19:39:35 +02:00
|
|
|
if (IsColliding(player))
|
2022-12-29 19:32:58 +02:00
|
|
|
{
|
2023-01-17 04:12:57 +02:00
|
|
|
if (player.attackHurtNetwork.moveName == "Shadowbreak")
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Knockback");
|
|
|
|
|
return;
|
2023-01-17 04:12:57 +02:00
|
|
|
}
|
2023-01-10 18:39:07 +02:00
|
|
|
if (player.attackHurtNetwork.attackType == AttackTypeEnum.Throw)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Grabbed");
|
|
|
|
|
return;
|
2023-01-10 18:39:07 +02:00
|
|
|
}
|
2023-01-08 18:48:39 +02:00
|
|
|
if (DemonicsPhysics.IsInCorner(player))
|
|
|
|
|
{
|
|
|
|
|
player.otherPlayer.knockback = 0;
|
|
|
|
|
player.otherPlayer.pushbackStart = player.otherPlayer.position;
|
|
|
|
|
player.otherPlayer.pushbackEnd = new DemonicsVector2(player.otherPlayer.position.x + (player.attackHurtNetwork.knockbackForce * -player.otherPlayer.flip), DemonicsPhysics.GROUND_POINT);
|
|
|
|
|
player.otherPlayer.pushbackDuration = player.attackHurtNetwork.knockbackDuration;
|
|
|
|
|
}
|
2023-01-07 23:17:55 +02:00
|
|
|
if (IsBlocking(player))
|
2022-12-29 19:32:58 +02:00
|
|
|
{
|
2023-01-07 23:17:55 +02:00
|
|
|
if (player.direction.y < 0)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "BlockLow");
|
2023-01-07 23:17:55 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Block");
|
2023-01-07 23:17:55 +02:00
|
|
|
}
|
2022-12-29 19:32:58 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-01-07 23:17:55 +02:00
|
|
|
if (player.attackHurtNetwork.hardKnockdown)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Airborne");
|
2023-01-07 23:17:55 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (player.attackHurtNetwork.knockbackArc == 0 || player.attackHurtNetwork.softKnockdown)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Hurt");
|
2023-01-07 23:17:55 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "HurtAir");
|
2023-01-07 23:17:55 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-12-29 19:32:58 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-12-29 14:40:06 +02:00
|
|
|
}
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|