Files

36 lines
1.4 KiB
C#
Raw Permalink Normal View History

using Demonics;
2022-12-27 18:26:23 +02:00
using UnityEngine;
2022-12-27 18:21:12 +02:00
public class KnockdownHardState : State
2022-12-26 03:47:56 +02:00
{
public override void UpdateLogic(PlayerNetwork player)
{
2022-12-27 13:12:53 +02:00
CheckFlip(player);
2022-12-26 03:47:56 +02:00
if (!player.enter)
{
2022-12-27 18:21:12 +02:00
player.player.PlayerUI.DisplayNotification(NotificationTypeEnum.Knockdown);
2022-12-26 03:47:56 +02:00
player.enter = true;
player.animationFrames = 0;
2023-01-10 18:39:07 +02:00
player.sound = "Landed";
2023-11-09 17:32:01 +02:00
player.SetParticle("KnockdownHard", new DemonVector2(player.position.x, player.position.y - 5));
player.velocity = new DemonVector2((DemonFloat)0, (DemonFloat)2.1f);
player.framedataEnum = FramedataTypesEnum.Knockdown;
2023-10-24 00:32:35 +03:00
CameraShake.Instance.Shake(new CameraShakerNetwork() { intensity = 18, timer = 0.12f });
return;
2022-12-26 03:47:56 +02:00
}
2023-10-23 01:51:56 +03:00
if (player.position.y > DemonicsPhysics.GROUND_POINT)
player.velocity = new DemonVector2(player.velocity.x, player.velocity.y - DemonicsPhysics.GRAVITY);
else
player.velocity = new DemonVector2(player.velocity.x, 0);
player.animationFrames++;
player.framedataEnum = FramedataTypesEnum.Knockdown;
2022-12-27 13:12:53 +02:00
player.hurtbox.active = false;
2022-12-26 03:47:56 +02:00
player.animation = "Knockdown";
ToIdleState(player);
}
private void ToIdleState(PlayerNetwork player)
{
if (player.animationFrames >= 60)
2023-01-23 18:31:58 +02:00
EnterState(player, "WakeUp");
2022-12-26 03:47:56 +02:00
}
}