Beispiel #1
0
        public void Update()
        {
            if (HighLogic.LoadedSceneIsFlight && !vessel.packed)
            {
                if (readyToFire && deployed)
                {
                    if (returnRoutine != null)
                    {
                        StopCoroutine(returnRoutine);
                        returnRoutine = null;
                    }

                    if (weaponManager && weaponManager.guardMode && weaponManager.selectedWeaponString == GetShortName())
                    {
                        if (Time.time - autoFireStartTime < autoFireDuration)
                        {
                            float fireInterval = 0.5f;
                            if (autoRippleRate > 0)
                            {
                                fireInterval = 60f / autoRippleRate;
                            }
                            if (Time.time - lastAutoFiredTime > fireInterval)
                            {
                                FireRocket();
                                lastAutoFiredTime = Time.time;
                            }
                        }
                    }
                    else if ((!weaponManager ||
                              (weaponManager.selectedWeaponString == GetShortName() && !weaponManager.guardMode)))
                    {
                        if (BDInputUtils.GetKeyDown(BDInputSettingsFields.WEAP_FIRE_KEY) &&
                            (vessel.isActiveVessel || BDArmorySettings.REMOTE_SHOOTING))
                        {
                            FireRocket();
                        }
                    }
                }

                if (GetRocketResource().amount != lastRocketsLeft)
                {
                    UpdateRocketScales();
                    lastRocketsLeft = GetRocketResource().amount;
                }

                if (vessel.isActiveVessel)
                {
                    gauge.UpdateAmmoMeter((float)(lastRocketsLeft / rocketsMax));
                }
            }
        }
Beispiel #2
0
        public override void OnUpdate()
        {
            if (HighLogic.LoadedSceneIsFlight)
            {
                if (readyToFire && deployed)
                {
                    if (returnRoutine != null)
                    {
                        StopCoroutine(returnRoutine);
                        returnRoutine = null;
                    }

                    if (weaponManager && weaponManager.guardMode && weaponManager.selectedWeaponString == GetShortName())
                    {
                        if (Time.time - autoFireStartTime < autoFireDuration)
                        {
                            float fireInterval = 0.5f;
                            if (autoRippleRate > 0)
                            {
                                fireInterval = 60f / autoRippleRate;
                            }
                            if (Time.time - lastAutoFiredTime > fireInterval)
                            {
                                FireRocket();
                                lastAutoFiredTime = Time.time;
                            }
                        }
                    }
                    else if ((!weaponManager ||
                              (weaponManager.selectedWeaponString == GetShortName() && !weaponManager.guardMode)))
                    {
                        if (BDInputUtils.GetKeyDown(BDInputSettingsFields.WEAP_FIRE_KEY) &&
                            (vessel.isActiveVessel || BDArmorySettings.REMOTE_SHOOTING))
                        {
                            FireRocket();
                        }
                    }
                }
            }
        }