Files

46 lines
1.7 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";
2023-06-27 17:23:24 +03:00
if (!player.hasJumped)
player.SetParticle("Jump", new DemonVector2(player.position.x, DemonicsPhysics.GROUND_POINT));
else
player.SetParticle("Fall", new DemonVector2(player.position.x, player.position.y + 18));
2022-12-26 03:47:56 +02:00
player.hasJumped = true;
player.animationFrames = 0;
2023-07-02 23:17:37 +03:00
player.velocity = new DemonVector2((DemonFloat)0, player.playerStats.JumpForce);
if (player.inputBuffer.CurrentTrigger().frame != 0)
{
player.isAir = true;
player.inputBuffer.triggers[player.inputBuffer.indexTrigger].frame = 0;
if (player.inputBuffer.CurrentTrigger().inputEnum == InputEnum.Special)
Arcana(player, player.isAir);
else
{
if (!(player.attackInput == InputEnum.Medium && player.isCrouch))
if (player.inputBuffer.CurrentTrigger().inputEnum != InputEnum.Throw)
Attack(player, player.isAir);
}
}
return;
2022-12-26 03:47:56 +02:00
}
player.animationFrames++;
2023-07-02 23:17:37 +03:00
player.velocity = new DemonVector2(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)
{
2023-07-02 23:17:37 +03:00
if (player.velocity.y <= (DemonFloat)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
}
}
}