43 lines
972 B
C#
43 lines
972 B
C#
using RoR2;
|
|
using UnityEngine;
|
|
|
|
namespace EntityStates.HermitCrab;
|
|
|
|
public class SpawnState : BaseState
|
|
{
|
|
private float stopwatch;
|
|
|
|
public static GameObject burrowPrefab;
|
|
|
|
public static float duration = 4f;
|
|
|
|
public static string spawnSoundString;
|
|
|
|
private static int SpawnStateHash = Animator.StringToHash("Spawn");
|
|
|
|
private static int SpawnParamHash = Animator.StringToHash("Spawn.playbackRate");
|
|
|
|
public override void OnEnter()
|
|
{
|
|
base.OnEnter();
|
|
Util.PlaySound(spawnSoundString, base.gameObject);
|
|
PlayAnimation("Body", SpawnStateHash, SpawnParamHash, duration);
|
|
EffectManager.SimpleMuzzleFlash(burrowPrefab, base.gameObject, "BurrowCenter", transmit: false);
|
|
}
|
|
|
|
public override void FixedUpdate()
|
|
{
|
|
base.FixedUpdate();
|
|
stopwatch += GetDeltaTime();
|
|
if (stopwatch >= duration && base.isAuthority)
|
|
{
|
|
outer.SetNextStateToMain();
|
|
}
|
|
}
|
|
|
|
public override InterruptPriority GetMinimumInterruptPriority()
|
|
{
|
|
return InterruptPriority.Death;
|
|
}
|
|
}
|