95 lines
2.3 KiB
C#
95 lines
2.3 KiB
C#
using RoR2;
|
|
using RoR2.Skills;
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
|
|
namespace EntityStates.VoidRaidCrab;
|
|
|
|
public class ChargeGauntlet : BaseState
|
|
{
|
|
[SerializeField]
|
|
public float duration;
|
|
|
|
[SerializeField]
|
|
public GameObject chargeEffectPrefab;
|
|
|
|
[SerializeField]
|
|
public string muzzleName;
|
|
|
|
[SerializeField]
|
|
public string animationLayerName;
|
|
|
|
[SerializeField]
|
|
public string animationStateName;
|
|
|
|
[SerializeField]
|
|
public string animationPlaybackRateParam;
|
|
|
|
[SerializeField]
|
|
public string enterSoundString;
|
|
|
|
[SerializeField]
|
|
public SkillDef skillDefToReplaceAtStocksEmpty;
|
|
|
|
[SerializeField]
|
|
public SkillDef nextSkillDef;
|
|
|
|
private GameObject chargeEffectInstance;
|
|
|
|
public override void OnEnter()
|
|
{
|
|
base.OnEnter();
|
|
PlayAnimation(animationLayerName, animationStateName, animationPlaybackRateParam, duration);
|
|
Util.PlaySound(enterSoundString, base.gameObject);
|
|
ChildLocator modelChildLocator = GetModelChildLocator();
|
|
if ((bool)modelChildLocator && (bool)chargeEffectPrefab)
|
|
{
|
|
Transform transform = modelChildLocator.FindChild(muzzleName) ?? base.characterBody.coreTransform;
|
|
if ((bool)transform)
|
|
{
|
|
chargeEffectInstance = Object.Instantiate(chargeEffectPrefab, transform.position, transform.rotation);
|
|
chargeEffectInstance.transform.parent = transform;
|
|
ScaleParticleSystemDuration component = chargeEffectInstance.GetComponent<ScaleParticleSystemDuration>();
|
|
if ((bool)component)
|
|
{
|
|
component.newDuration = duration;
|
|
}
|
|
}
|
|
}
|
|
PhasedInventorySetter component2 = GetComponent<PhasedInventorySetter>();
|
|
if ((bool)component2 && NetworkServer.active)
|
|
{
|
|
component2.AdvancePhase();
|
|
}
|
|
if ((bool)nextSkillDef)
|
|
{
|
|
GenericSkill genericSkill = base.skillLocator.FindSkillByDef(skillDefToReplaceAtStocksEmpty);
|
|
if ((bool)genericSkill && genericSkill.stock == 0)
|
|
{
|
|
genericSkill.SetBaseSkill(nextSkillDef);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void FixedUpdate()
|
|
{
|
|
base.FixedUpdate();
|
|
if (base.isAuthority && base.fixedAge >= duration)
|
|
{
|
|
_ = (bool)VoidRaidGauntletController.instance;
|
|
outer.SetNextState(new ChannelGauntlet());
|
|
}
|
|
}
|
|
|
|
public override void OnExit()
|
|
{
|
|
EntityState.Destroy(chargeEffectInstance);
|
|
base.OnExit();
|
|
}
|
|
|
|
public override InterruptPriority GetMinimumInterruptPriority()
|
|
{
|
|
return InterruptPriority.Death;
|
|
}
|
|
}
|