public void CheckWaitingState(TimeUpdateEvent evt, ShaftWaitingWeaponControllerNode weapon) { if (InputManager.CheckAction(ShotActions.SHOT)) { this.StartWorkActivationStateIfPossible(weapon, evt.DeltaTime); } else { this.StartQuickShotIfPossible(weapon); } }
private void StartWorkActivationStateIfPossible(ShaftWaitingWeaponControllerNode weapon, float dt) { if (!weapon.Entity.HasComponent <WeaponUndergroundComponent>()) { if (weapon.shaftWaitingState.WaitingTimer < weapon.shaftStateConfig.WaitingToActivationTransitionTimeSec) { weapon.shaftWaitingState.WaitingTimer += dt; } else if (weapon.weaponEnergy.Energy >= 1f) { StateUtils.SwitchEntityState <ShaftAimingWorkActivationStateComponent>(weapon.Entity, this.weaponStates); } } }
private void StartQuickShotIfPossible(ShaftWaitingWeaponControllerNode weapon) { CooldownTimerComponent cooldownTimer = weapon.cooldownTimer; if (weapon.weaponEnergy.Energy < weapon.shaftEnergy.UnloadEnergyPerQuickShot) { StateUtils.SwitchEntityState <ShaftIdleStateComponent>(weapon.Entity, this.weaponStates); } else if (cooldownTimer.CooldownTimerSec > 0f) { StateUtils.SwitchEntityState <ShaftIdleStateComponent>(weapon.Entity, this.weaponStates); } else { this.MakeQuickShot(weapon.Entity); } }