You've already forked Darklings-FightingGame
mirror of
https://github.com/izzy2lost/Darklings-FightingGame.git
synced 2026-03-10 11:35:19 -07:00
30 lines
926 B
C#
30 lines
926 B
C#
using UnityEngine;
|
|
|
|
public class JumpState : AirParentState
|
|
{
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
{
|
|
if (!player.enter)
|
|
{
|
|
player.enter = true;
|
|
player.sound = "Jump";
|
|
player.SetEffect("Jump", player.position);
|
|
player.hasJumped = true;
|
|
player.animationFrames = 0;
|
|
player.velocity = new DemonicsVector2((DemonicsFloat)0, player.playerStats.JumpForce);
|
|
}
|
|
player.animation = "Jump";
|
|
player.animationFrames++;
|
|
player.velocity = new DemonicsVector2(player.velocity.x, player.velocity.y - DemonicsPhysics.GRAVITY);
|
|
base.UpdateLogic(player);
|
|
ToFallState(player);
|
|
}
|
|
private void ToFallState(PlayerNetwork player)
|
|
{
|
|
if (player.velocity.y <= (DemonicsFloat)0)
|
|
{
|
|
player.enter = false;
|
|
player.state = "Fall";
|
|
}
|
|
}
|
|
} |