コード例 #1
0
        private void OnFlyByWire(FlightCtrlState st)
        {
            switch (_tick)
            {
            case 7:
            case 6:
            case 5:
            case 4:
            case 3:
            case 2:
            case 1:
                st.mainThrottle = HighLogic.CurrentGame.Parameters.CustomParams <NC>().defaultInitialThrottle;
                break;

            case 0:
                //st.mainThrottle = 1f;
                Log.Info("OnFlyByWire, before GravityTurnAPI.Launch");
                if (GravityTurnAPI.Launch())      // If GravityTurn is available
                {
                    break;
                }

                st.mainThrottle = HighLogic.CurrentGame.Parameters.CustomParams <NC>().defaultThrottle;
                FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.SAS, true);

                break;

            default:
                //st.mainThrottle = 0f;
                st.mainThrottle = HighLogic.CurrentGame.Parameters.CustomParams <NC>().defaultThrottle;
                break;
            }
        }
コード例 #2
0
        private IEnumerator TickLaunch()
        {
            Log.Info("TickLaunch");
            countdownStartTime = Planetarium.GetUniversalTime();
            paused             = false;
            holdPlayed         = false;
            int count = 10;

            if (ConfigInfo.Instance != null)
            {
                if (ConfigInfo.Instance.CurrentAudio != null)
                {
                    count = ConfigInfo.Instance.IsSoundEnabled && ConfigInfo.Instance.CurrentAudio.TimerSounds.Any() ? ConfigInfo.Instance.CurrentAudio.TimerSounds.Count - 1 : 15;
                }
            }


            for (var i = count; i >= 0; i--)
            {
                while (paused)
                {
                    yield return(new WaitForSeconds(1f));
                }
//                while (paused && (_audioSource == null || (_audioSource != null && !_audioSource.isPlaying)))
//                        yield return new WaitForSeconds(1f);
                _tick = i;
                var oneShotStartTime = Planetarium.GetUniversalTime();

                if (_audioSource != null && ConfigInfo.Instance != null && ConfigInfo.Instance.CurrentAudio != null)
                {
                    _audioSource.PlayOneShot(ConfigInfo.Instance.CurrentAudio.TimerSounds.FirstOrDefault(x => x.name.EndsWith($"/{i}")));
                }

                if (_stages != null && _stages.Count > i)
                {
                    _stages[i]();
                }
                var oneShotEndTime = Planetarium.GetUniversalTime();
                Log.Info("tick: " + _tick.ToString() + ",  starttime/endtime: " + oneShotStartTime.ToString("n4") + "/" + oneShotEndTime.ToString("n4"));
                var oneShotElapsedTime = oneShotEndTime - oneShotStartTime;
                if (oneShotElapsedTime < 1.0f && _tick > 0)
                {
                    yield return(new WaitForSeconds(1.0f - (float)oneShotElapsedTime));
                }
            }
            Log.Info("final _tic: " + _tick);
            GravityTurnAPI.Launch();
        }
コード例 #3
0
        private void OnFlyByWire(FlightCtrlState st)
        {
            Log.Info("OnFlyByWire, tic: " + _tick);
            switch (_tick)
            {
            case 7:
            case 6:
            case 5:
            case 4:
            case 3:
            case 2:
            case 1:
                st.mainThrottle = ConfigInfo.Instance.VesselOptions[ModuleNASACountdown.CraftName(FlightGlobals.ActiveVessel)].defaultInitialThrottle;
                break;

            case 0:
                //st.mainThrottle = 1f;
                Log.Info("OnFlyByWire, before GravityTurnAPI.Launch");
                if (GravityTurnAPI.Launch())      // If GravityTurn is available
                {
                    break;
                }

                st.mainThrottle = ConfigInfo.Instance.VesselOptions[ModuleNASACountdown.CraftName(FlightGlobals.ActiveVessel)].defaultThrottle;
                if (ConfigInfo.Instance.VesselOptions[ModuleNASACountdown.CraftName(FlightGlobals.ActiveVessel)].enableSAS)
                {
                    FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.SAS, true);
                }

                break;

            default:
                if (ConfigInfo.Instance.VesselOptions[ModuleNASACountdown.CraftName(FlightGlobals.ActiveVessel)].enableSAS)
                {
                    FlightGlobals.ActiveVessel.ActionGroups.SetGroup(KSPActionGroup.SAS, true);
                }
                //st.mainThrottle = 0f;
                st.mainThrottle = ConfigInfo.Instance.VesselOptions[ModuleNASACountdown.CraftName(FlightGlobals.ActiveVessel)].defaultThrottle;
                break;
            }
        }