2023-01-16 13:26:54 +02:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
2023-01-09 18:16:00 +02:00
|
|
|
public class GrabbedState : State
|
|
|
|
|
{
|
|
|
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (!player.enter)
|
|
|
|
|
{
|
2023-01-16 13:26:54 +02:00
|
|
|
if (player.otherPlayer.state == "Arcana")
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player.otherPlayer, "ArcanaEnd");
|
2023-01-16 13:26:54 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player.otherPlayer, "Throw");
|
2023-01-16 13:26:54 +02:00
|
|
|
}
|
2023-01-09 18:16:00 +02:00
|
|
|
player.enter = true;
|
|
|
|
|
player.animationFrames = 0;
|
|
|
|
|
player.player.StopShakeCoroutine();
|
|
|
|
|
}
|
2023-01-10 18:39:07 +02:00
|
|
|
player.velocity = DemonicsVector2.Zero;
|
|
|
|
|
player.animation = "HurtAir";
|
2023-01-09 18:16:00 +02:00
|
|
|
player.animationFrames++;
|
2023-01-10 20:10:11 +02:00
|
|
|
ThrowBreak(player);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ThrowBreak(PlayerNetwork player)
|
|
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
if (player.inputBuffer.CurrentInput().pressed && player.inputBuffer.CurrentInput().inputEnum == InputEnum.Throw)
|
2023-01-10 20:10:11 +02:00
|
|
|
{
|
2023-01-18 21:41:03 +02:00
|
|
|
if (player.otherPlayer.state != "Arcana" && player.animationFrames <= 6)
|
|
|
|
|
{
|
|
|
|
|
player.SetEffect("Impact", new DemonicsVector2((player.position.x + player.otherPlayer.position.x) / 2, player.position.y + (player.pushbox.size.y / 2)));
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Knockback");
|
|
|
|
|
EnterState(player.otherPlayer, "Knockback");
|
2023-01-18 21:41:03 +02:00
|
|
|
}
|
2023-01-10 20:10:11 +02:00
|
|
|
}
|
2023-01-09 18:16:00 +02:00
|
|
|
}
|
|
|
|
|
}
|