Files

52 lines
1.9 KiB
C#
Raw Normal View History

2022-12-26 03:47:56 +02:00
using UnityEngine;
public class JumpState : AirParentState
{
public override void UpdateLogic(PlayerNetwork player)
{
if (!player.enter)
{
2023-04-12 01:27:02 +03:00
player.animation = "Jump";
2022-12-26 03:47:56 +02:00
player.enter = true;
player.sound = "Jump";
player.SetEffect("Jump", player.position);
player.hasJumped = true;
player.animationFrames = 0;
2022-12-31 20:46:52 +02:00
player.velocity = new DemonicsVector2((DemonicsFloat)0, player.playerStats.JumpForce);
if (player.inputBuffer.CurrentInput().frame != 0)
{
player.isAir = true;
player.inputBuffer.inputItems[player.inputBuffer.index].frame = 0;
if (player.inputBuffer.CurrentInput().inputEnum == InputEnum.Special)
{
Arcana(player, player.isAir);
}
else
{
if (!(player.attackInput == InputEnum.Medium && player.isCrouch))
{
if (player.inputBuffer.CurrentInput().inputEnum != InputEnum.Throw)
{
if (!(player.attackInput == InputEnum.Heavy && !player.isCrouch && player.inputBuffer.CurrentInput().inputEnum == InputEnum.Heavy && player.direction.y >= 0))
{
Attack(player, player.isAir);
}
}
}
}
}
return;
2022-12-26 03:47:56 +02:00
}
player.animationFrames++;
2022-12-31 20:46:52 +02:00
player.velocity = new DemonicsVector2(player.velocity.x, player.velocity.y - DemonicsPhysics.GRAVITY);
2022-12-26 03:47:56 +02:00
ToFallState(player);
base.UpdateLogic(player);
2022-12-26 03:47:56 +02:00
}
private void ToFallState(PlayerNetwork player)
{
2022-12-31 20:46:52 +02:00
if (player.velocity.y <= (DemonicsFloat)0)
2022-12-26 03:47:56 +02:00
{
2023-01-23 18:31:58 +02:00
EnterState(player, "Fall");
2022-12-26 03:47:56 +02:00
}
}
}