コード例 #1
0
ファイル: RocketLauncher.cs プロジェクト: terrynoya/BDArmory
        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));
                }
            }
        }
コード例 #2
0
ファイル: RocketLauncher.cs プロジェクト: sturmhauke/BDArmory
        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();
                        }
                    }
                }
            }
        }