public void StartShotIfPossible(EarlyUpdateEvent evt, SelfTankNode selfTank, [JoinByTank] DiscreteWeaponControllerNode discreteWeaponEnergyController) { CooldownTimerComponent cooldownTimer = discreteWeaponEnergyController.cooldownTimer; if (((discreteWeaponEnergyController.weaponEnergy.Energy >= discreteWeaponEnergyController.discreteWeaponEnergy.UnloadEnergyPerShot) && (cooldownTimer.CooldownTimerSec <= 0f)) && (InputManager.GetAxisOrKey(ShotActions.SHOT) != 0f)) { base.ScheduleEvent <BeforeShotEvent>(discreteWeaponEnergyController); base.ScheduleEvent <ShotPrepareEvent>(discreteWeaponEnergyController); base.ScheduleEvent <PostShotEvent>(discreteWeaponEnergyController); } }
public void StartShotIfPossible(EarlyUpdateEvent evt, DiscreteWeaponControllerNode discreteWeaponEnergyController, [JoinByTank] AutopilotTankNode autopilotTank) { float unloadEnergyPerShot = discreteWeaponEnergyController.discreteWeaponEnergy.UnloadEnergyPerShot; float energy = discreteWeaponEnergyController.weaponEnergy.Energy; CooldownTimerComponent cooldownTimer = discreteWeaponEnergyController.cooldownTimer; if ((autopilotTank.autopilotWeaponController.Fire && (energy >= unloadEnergyPerShot)) && (cooldownTimer.CooldownTimerSec <= 0f)) { base.ScheduleEvent <BeforeShotEvent>(discreteWeaponEnergyController); base.ScheduleEvent <ShotPrepareEvent>(discreteWeaponEnergyController); base.ScheduleEvent <PostShotEvent>(discreteWeaponEnergyController); } }