using RoR2; using UnityEngine; namespace EntityStates.Drone.DroneWeapon; public class FireGatling : BaseState { public static GameObject effectPrefab; public static GameObject hitEffectPrefab; public static GameObject tracerEffectPrefab; public static float damageCoefficient; public static float force; public static float minSpread; public static float maxSpread; public static float baseDuration = 2f; public static string fireGatlingSoundString; public int bulletCountCurrent = 1; private float duration; private static int FireGatlingStateHash = Animator.StringToHash("FireGatling"); public override void OnEnter() { base.OnEnter(); duration = baseDuration / attackSpeedStat; string muzzleName = "Muzzle"; Util.PlaySound(fireGatlingSoundString, base.gameObject); PlayAnimation("Gesture", FireGatlingStateHash); if ((bool)effectPrefab) { EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, muzzleName, transmit: false); } if (base.isAuthority) { Ray aimRay = GetAimRay(); BulletAttack bulletAttack = new BulletAttack(); bulletAttack.owner = base.gameObject; bulletAttack.weapon = base.gameObject; bulletAttack.origin = aimRay.origin; bulletAttack.aimVector = aimRay.direction; bulletAttack.minSpread = minSpread; bulletAttack.maxSpread = maxSpread; bulletAttack.damage = damageCoefficient * damageStat; bulletAttack.force = force; bulletAttack.tracerEffectPrefab = tracerEffectPrefab; bulletAttack.muzzleName = muzzleName; bulletAttack.hitEffectPrefab = hitEffectPrefab; bulletAttack.isCrit = Util.CheckRoll(critStat, base.characterBody.master); bulletAttack.Fire(); } } 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; } }