public void StartShotIfPossible(EarlyUpdateEvent evt, ReadyRailgunChargingWeaponControllerNode chargingWeaponController, [JoinSelf] SingleNode <ShootableComponent> node, [JoinByTank] ActiveTankNode selfActiveTank)
        {
            CooldownTimerComponent cooldownTimer = chargingWeaponController.cooldownTimer;

            if (((chargingWeaponController.weaponEnergy.Energy >= chargingWeaponController.discreteWeaponEnergy.UnloadEnergyPerShot) && (cooldownTimer.CooldownTimerSec <= 0f)) && InputManager.CheckAction(ShotActions.SHOT))
            {
                base.ScheduleEvent <SelfRailgunChargingShotEvent>(chargingWeaponController);
            }
        }
Ejemplo n.º 2
0
 private bool CheckBlock(CooldownTimerComponent cooldownTimerComponent, Entity slot)
 {
     if (cooldownTimerComponent.CooldownTimerSec <= 0f)
     {
         return(true);
     }
     slot.RemoveComponentIfPresent <InventorySlotTemporaryBlockedByClientComponent>();
     return(false);
 }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
        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);
            }
        }
        public void RunWorkingStream(EarlyUpdateEvent evt, StreamWeaponWorkingControllerNode workingWeapon, [JoinByTank] SelfActiveTankNode selfActiveTank)
        {
            Entity weapon = workingWeapon.Entity;
            CooldownTimerComponent cooldownTimer = workingWeapon.cooldownTimer;

            if (workingWeapon.weaponEnergy.Energy <= 0f)
            {
                SwitchWorkingModeToIdleMode(weapon);
            }
            else if (InputManager.GetActionKeyUp(ShotActions.SHOT))
            {
                SwitchWorkingModeToIdleMode(weapon);
            }
            else if ((cooldownTimer.CooldownTimerSec <= 0f) && workingWeapon.Entity.HasComponent <ShootableComponent>())
            {
                base.ScheduleEvent <BeforeShotEvent>(workingWeapon);
                base.ScheduleEvent <ShotPrepareEvent>(workingWeapon);
            }
        }
        protected void UpdateCooldownOnShot(CooldownTimerComponent cooldownTimerComponent, WeaponCooldownComponent weaponCooldownComponent)
        {
            float cooldownIntervalSec = weaponCooldownComponent.CooldownIntervalSec;

            cooldownTimerComponent.CooldownTimerSec = cooldownIntervalSec;
        }