Files

74 lines
2.7 KiB
C#
Raw Normal View History

2023-10-11 02:25:05 +03:00
using SharedGame;
2023-01-10 20:10:11 +02:00
using UnityEngine;
public class ShadowbreakState : State
{
public override void UpdateLogic(PlayerNetwork player)
{
if (!player.enter)
{
2023-01-14 19:39:35 +02:00
player.attackNetwork = new AttackNetwork()
{
name = "Shadowbreak",
moveName = "Shadowbreak",
impactSound = "",
attackSound = "",
hurtEffect = "",
2023-10-11 02:25:05 +03:00
hitstop = 20,
blockStun = 15,
2023-01-19 02:51:24 +02:00
cameraShakerNetwork = new CameraShakerNetwork() { intensity = 35, timer = 0.15f }
2023-01-14 19:39:35 +02:00
};
2023-01-10 20:10:11 +02:00
SetTopPriority(player);
CheckFlip(player);
player.enter = true;
player.animationFrames = 0;
2023-01-14 19:39:35 +02:00
player.sound = "Shadowbreak";
player.canChainAttack = false;
player.usedShadowbreak = true;
2023-07-02 23:17:37 +03:00
player.position = new DemonVector2(player.position.x, player.position.y + 15);
2023-10-11 02:25:05 +03:00
GameplayManager.Instance.SetCameraTargets(1f, 0.0f);
2023-07-02 23:17:37 +03:00
player.InitializeProjectile("Shadowbreak", player.attackNetwork, (DemonFloat)0, 0, false);
player.SetProjectile("Shadowbreak", new DemonVector2(player.position.x, player.position.y + player.pushbox.size.y), false);
2023-01-19 02:51:24 +02:00
CameraShake.Instance.Shake(player.attackNetwork.cameraShakerNetwork);
return;
2023-01-10 20:10:11 +02:00
}
2023-07-02 23:17:37 +03:00
player.velocity = DemonVector2.Zero;
2023-01-14 19:39:35 +02:00
player.animation = "Shadowbreak";
2023-01-10 20:10:11 +02:00
player.animationFrames++;
ToHurtState(player);
2023-01-14 19:39:35 +02:00
ToFallState(player);
2023-01-10 20:10:11 +02:00
}
2023-01-14 19:39:35 +02:00
private void ToFallState(PlayerNetwork player)
2023-01-10 20:10:11 +02:00
{
if (player.animationFrames >= 60)
{
2023-10-11 02:25:05 +03:00
GameplayManager.Instance.SetCameraTargets(0.5f, 0.5f);
2023-01-20 17:59:16 +02:00
CheckTrainingGauges(player);
2023-01-23 18:31:58 +02:00
EnterState(player, "Fall");
2023-01-10 20:10:11 +02:00
}
}
private void ToHurtState(PlayerNetwork player)
{
if (IsColliding(player))
{
if (player.attackHurtNetwork.moveName == "Shadowbreak")
{
2023-10-11 02:25:05 +03:00
GameplayManager.Instance.SetCameraTargets(0.5f, 0.5f);
EnterState(player, "Knockback");
return;
}
if (player.attackHurtNetwork.attackType == AttackTypeEnum.Throw)
return;
if (player.attackHurtNetwork.hardKnockdown || player.attackHurtNetwork.softKnockdown && player.position.y > DemonicsPhysics.GROUND_POINT)
{
2023-10-11 02:25:05 +03:00
GameplayManager.Instance.SetCameraTargets(0.5f, 0.5f);
EnterState(player, "Airborne");
}
else
{
2023-10-11 02:25:05 +03:00
GameplayManager.Instance.SetCameraTargets(0.5f, 0.5f);
EnterState(player, "HurtAir");
}
}
}
2023-01-10 20:10:11 +02:00
}