r2mods/ilspy_dump/ror2_csproj/EntityStates.EngiTurret.Eng.../FireGauss.cs

90 lines
2.2 KiB
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using RoR2;
using UnityEngine;
namespace EntityStates.EngiTurret.EngiTurretWeapon;
public class FireGauss : BaseState
{
public static GameObject effectPrefab;
public static GameObject hitEffectPrefab;
public static GameObject tracerEffectPrefab;
public static string attackSoundString;
public static float damageCoefficient;
public static float force;
public static float minSpread;
public static float maxSpread;
public static int bulletCount;
public static float baseDuration = 2f;
public int bulletCountCurrent = 1;
private float duration;
private static int FireGaussStateHash = Animator.StringToHash("FireGauss");
private static int FireGaussParamHash = Animator.StringToHash("FireGauss.playbackRate");
public override void OnEnter()
{
base.OnEnter();
duration = baseDuration / attackSpeedStat;
Util.PlaySound(attackSoundString, base.gameObject);
Ray aimRay = GetAimRay();
StartAimMode(aimRay);
PlayAnimation("Gesture", FireGaussStateHash, FireGaussParamHash, duration);
string muzzleName = "Muzzle";
if ((bool)effectPrefab)
{
EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, muzzleName, transmit: false);
}
if (base.isAuthority)
{
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.bulletCount = 1u;
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.HitEffectNormal = false;
bulletAttack.radius = 0.15f;
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;
}
}