2023-01-15 01:54:52 +02:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ArcanaEndState : State
|
|
|
|
|
{
|
|
|
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (!player.enter)
|
|
|
|
|
{
|
2023-04-06 15:16:02 +03:00
|
|
|
SetTopPriority(player);
|
2023-01-19 17:07:46 +02:00
|
|
|
if (player.direction.x < 0 && player.flip == 1 || player.direction.x > 0 && player.flip == -1)
|
2023-01-16 13:26:54 +02:00
|
|
|
{
|
|
|
|
|
player.flip *= -1;
|
|
|
|
|
}
|
2023-01-15 01:54:52 +02:00
|
|
|
player.enter = true;
|
2023-01-16 13:26:54 +02:00
|
|
|
player.animationFrames = 0;
|
|
|
|
|
player.animation = "5AEnd";
|
|
|
|
|
player.attackFrames = DemonicsAnimator.GetMaxAnimationFrames(player.playerStats._animation, player.animation);
|
|
|
|
|
player.otherPlayer.pushbox.active = false;
|
2023-07-02 23:17:37 +03:00
|
|
|
player.velocity = DemonVector2.Zero;
|
2023-04-04 21:43:30 +03:00
|
|
|
return;
|
|
|
|
|
}
|
2023-04-06 15:16:02 +03:00
|
|
|
player.animationFrames++;
|
|
|
|
|
player.attackFrames--;
|
2023-01-16 13:26:54 +02:00
|
|
|
if (player.otherPlayer.state == "Grabbed")
|
|
|
|
|
{
|
2023-07-02 23:17:37 +03:00
|
|
|
DemonVector2 grabPoint = player.player.PlayerAnimator.GetGrabPoint(player.animation, player.animationFrames);
|
|
|
|
|
player.otherPlayer.position = new DemonVector2(player.position.x + (grabPoint.x * player.flip), player.position.y + grabPoint.y);
|
2023-01-16 13:26:54 +02:00
|
|
|
}
|
2023-01-15 13:05:14 +02:00
|
|
|
|
2023-10-15 02:14:59 +03:00
|
|
|
bool arcanaEnd = player.player.PlayerAnimator.GetThrowArcanaEnd(player.animation, player.animationFrames);
|
|
|
|
|
if (arcanaEnd && player.otherPlayer.state == "Grabbed")
|
2023-01-16 13:26:54 +02:00
|
|
|
{
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player.otherPlayer, "Airborne");
|
2023-01-16 13:26:54 +02:00
|
|
|
}
|
2023-07-02 23:17:37 +03:00
|
|
|
DemonVector2 jump = player.player.PlayerAnimator.GetJump(player.animation, player.animationFrames);
|
2023-01-16 13:26:54 +02:00
|
|
|
if (player.pushbackStart != jump)
|
|
|
|
|
{
|
|
|
|
|
player.pushbackStart = jump;
|
2023-07-02 23:17:37 +03:00
|
|
|
player.velocity = new DemonVector2(jump.x, jump.y);
|
2023-01-16 13:26:54 +02:00
|
|
|
}
|
2023-07-02 23:17:37 +03:00
|
|
|
player.velocity = new DemonVector2(player.velocity.x, player.velocity.y - DemonicsPhysics.GRAVITY);
|
2023-01-16 13:26:54 +02:00
|
|
|
ToFallState(player);
|
|
|
|
|
}
|
|
|
|
|
private void ToFallState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.attackFrames <= 0)
|
|
|
|
|
{
|
|
|
|
|
if (player.attackNetwork.cameraShakerNetwork.timer > 0)
|
|
|
|
|
CameraShake.Instance.Shake(player.attackNetwork.cameraShakerNetwork);
|
|
|
|
|
player.sound = "Impact1";
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Fall");
|
2023-01-15 01:54:52 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|