64 lines
1.6 KiB
C#
64 lines
1.6 KiB
C#
|
using RoR2;
|
||
|
using RoR2.Projectile;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace EntityStates.LemurianMonster;
|
||
|
|
||
|
public class FireFireball : BaseState
|
||
|
{
|
||
|
public static GameObject projectilePrefab;
|
||
|
|
||
|
public static GameObject effectPrefab;
|
||
|
|
||
|
public static float baseDuration = 2f;
|
||
|
|
||
|
public static float damageCoefficient = 1.2f;
|
||
|
|
||
|
public static float force = 20f;
|
||
|
|
||
|
public static string attackString;
|
||
|
|
||
|
private float duration;
|
||
|
|
||
|
private static int FireFireballStateHash = Animator.StringToHash("FireFireball");
|
||
|
|
||
|
private static int FireFireballParamHash = Animator.StringToHash("FireFireball.playbackRate");
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
base.OnEnter();
|
||
|
duration = baseDuration / attackSpeedStat;
|
||
|
PlayAnimation("Gesture", FireFireballStateHash, FireFireballParamHash, duration);
|
||
|
Util.PlaySound(attackString, base.gameObject);
|
||
|
Ray aimRay = GetAimRay();
|
||
|
string muzzleName = "MuzzleMouth";
|
||
|
if ((bool)effectPrefab)
|
||
|
{
|
||
|
EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, muzzleName, transmit: false);
|
||
|
}
|
||
|
if (base.isAuthority)
|
||
|
{
|
||
|
ProjectileManager.instance.FireProjectile(projectilePrefab, aimRay.origin, Util.QuaternionSafeLookRotation(aimRay.direction), base.gameObject, damageStat * damageCoefficient, force, Util.CheckRoll(critStat, base.characterBody.master));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override void OnExit()
|
||
|
{
|
||
|
base.OnExit();
|
||
|
}
|
||
|
|
||
|
public override void FixedUpdate()
|
||
|
{
|
||
|
base.FixedUpdate();
|
||
|
if (base.fixedAge >= duration && base.isAuthority)
|
||
|
{
|
||
|
outer.SetNextStateToMain();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override InterruptPriority GetMinimumInterruptPriority()
|
||
|
{
|
||
|
return InterruptPriority.Skill;
|
||
|
}
|
||
|
}
|