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