public bool CheckTimeOfDay() { if (_homeBody == null) { _homeBody = FlightGlobals.GetHomeBody(); } double localTime = Sun.Instance.GetLocalTimeAtPosition(Utils.KscLatitude, Utils.KscLongitude, _homeBody); Enums.TimesOfDay tod = Enums.TimeToTimeOfDay(localTime); if ((tod & timeOfDay) != tod) { return(false); } return(true); }
public bool CheckTimeOfDay() { if (SoundtrackEditor.CurrentSituation.scene == Enums.Scenes.SpaceCentre) { if (_homeBody == null) { _homeBody = FlightGlobals.GetHomeBody(); } double localTime = Sun.Instance.GetLocalTimeAtPosition(Utils.KscLatitude, Utils.KscLongitude, _homeBody); Enums.TimesOfDay tod = Enums.TimeToTimeOfDay(localTime); if ((tod & timeOfDay) != tod) { return(false); } } return(true); }
private void UpdateSituation() { bool changed = false; // Throws exceptions before the initial loading screen is completed. if (SoundtrackEditor.CurrentSituation.scene == Enums.Scenes.Flight) { if (IsFlightSituationChanged()) { changed = true; } } else if (SoundtrackEditor.CurrentSituation.scene != Enums.Scenes.SpaceCentre) { SoundtrackEditor.CurrentSituation.paused = Enums.Selector.False; } if (SoundtrackEditor.CurrentSituation.scene == Enums.Scenes.SpaceCentre || SoundtrackEditor.CurrentSituation.scene == Enums.Scenes.Flight) { if (MonitorTimeOfDay) { if (_homeBody == null) { _homeBody = FlightGlobals.GetHomeBody(); } double localTime = Sun.Instance.GetLocalTimeAtPosition(Utils.KscLatitude, Utils.KscLongitude, _homeBody); Enums.TimesOfDay tod = Enums.TimeToTimeOfDay(localTime); if (SoundtrackEditor.CurrentSituation.timeOfDay != tod) { SoundtrackEditor.CurrentSituation.timeOfDay = tod; changed = true; } } } if (changed) { SoundtrackEditor.Instance.OnSituationChanged(); } }
private void UpdateSituation() { bool changed = false; // Throws exceptions before the initial loading screen is completed. if (SoundtrackEditor.CurrentSituation.scene == Enums.Scenes.Flight) { Vessel v = SoundtrackEditor.InitialLoadingComplete ? FlightGlobals.ActiveVessel : null; if (v != null) { Enums.Selector inAtmosphere = v.atmDensity > 0 ? Enums.Selector.True : Enums.Selector.False; if (SoundtrackEditor.CurrentSituation.inAtmosphere != inAtmosphere) { SoundtrackEditor.CurrentSituation.inAtmosphere = inAtmosphere; if (MonitorInAtmosphere) { Utils.Log("In atmosphere changed"); changed = true; } } // For surface velocity, orbital velocity and altitude, check if we crossed the monitored point going in either direction. if (MonitorSurfaceVelocity) { if ((v.srf_velocity.magnitude > _maxSrfVel && v.srf_velocity.magnitude < _previousSrfVel) || (v.srf_velocity.magnitude < _maxSrfVel && v.srf_velocity.magnitude > _previousSrfVel)) { changed = true; } if ((v.srf_velocity.magnitude > _minSrfVel && v.srf_velocity.magnitude < _previousSrfVel) || (v.srf_velocity.magnitude < _minSrfVel && v.srf_velocity.magnitude > _previousSrfVel)) { changed = true; } _previousSrfVel = v.srf_velocity.magnitude; } if (MonitorOrbitalVelocity) { if ((v.obt_velocity.magnitude > _maxObtVel && v.obt_velocity.magnitude < _previousObtVel) || (v.obt_velocity.magnitude < _maxObtVel && v.obt_velocity.magnitude > _previousObtVel)) { changed = true; } if ((v.obt_velocity.magnitude > _minObtVel && v.obt_velocity.magnitude < _previousObtVel) || (v.obt_velocity.magnitude < _minObtVel && v.obt_velocity.magnitude > _previousObtVel)) { changed = true; } _previousObtVel = v.obt_velocity.magnitude; } if (MonitorAltitude) { if ((v.altitude > _maxAlt && v.altitude < _previousAlt) || (v.altitude < _maxAlt && v.altitude > _previousAlt)) { changed = true; } if ((v.altitude > _minAlt && v.altitude < _previousAlt) || (v.altitude < _minAlt && v.altitude > _previousAlt)) { changed = true; } _previousAlt = v.altitude; } if (MonitorNearestVessel) { Vessel newVessel = Utils.GetNearestVessel(_minVesselDist, _maxVesselDist, v); if (newVessel != null && NearestVessel != newVessel) { NearestVessel = newVessel; changed = true; } } if (MonitorVesselState) { if (_previousVesselState != Enums.ConvertVesselState(v.state)) { Utils.Log("Vessel state changed"); _previousVesselState = Enums.ConvertVesselState(v.state); changed = true; } } } } else if (SoundtrackEditor.CurrentSituation.scene == Enums.Scenes.SpaceCentre) { if (MonitorTimeOfDay) { if (_homeBody == null) { _homeBody = FlightGlobals.GetHomeBody(); } double localTime = Sun.Instance.GetLocalTimeAtPosition(Utils.KscLatitude, Utils.KscLongitude, _homeBody); Enums.TimesOfDay tod = Enums.TimeToTimeOfDay(localTime); if (SoundtrackEditor.CurrentSituation.timeOfDay != tod) { SoundtrackEditor.CurrentSituation.timeOfDay = tod; changed = true; } } } else { SoundtrackEditor.CurrentSituation.paused = Enums.Selector.False; } if (changed) { SoundtrackEditor.Instance.OnSituationChanged(); } }
private void UpdateSituation() { bool changed = false; // Throws exceptions before the initial loading screen is completed. if (SoundtrackEditor.CurrentSituation.scene == Enums.Scenes.Flight) { Vessel v = SoundtrackEditor.InitialLoadingComplete ? FlightGlobals.ActiveVessel : null; if (v != null) { Enums.Selector inAtmosphere = v.atmDensity > 0 ? Enums.Selector.True : Enums.Selector.False; if (SoundtrackEditor.CurrentSituation.inAtmosphere != inAtmosphere) { SoundtrackEditor.CurrentSituation.inAtmosphere = inAtmosphere; if (MonitorInAtmosphere) { Utils.Log("In atmosphere changed"); changed = true; } } //FlightGlobals.currentMainBody.maxAtmosphereAltitude if (MonitorSurfaceVelocity) { if (_maxSrfVel < v.srf_velocity.magnitude) { //Utils.Log("Above maximum surface velocity"); changed = true; } if (_minSrfVel > v.srf_velocity.magnitude) { //Utils.Log("Below minimum surface velocity"); changed = true; } } if (MonitorOrbitalVelocity) { if (_maxObtVel < v.obt_velocity.magnitude) { //Utils.Log("Above maximum orbital velocity"); changed = true; } if (_minObtVel > v.obt_velocity.magnitude) { //Utils.Log("Below minimum orbital velocity"); changed = true; } } if (MonitorAltitude) { if (_maxAlt < v.altitude) { //Utils.Log("Above maximum altitude"); changed = true; } if (_minAlt > v.altitude) { //Utils.Log("Below minimum altitude"); changed = true; } } if (MonitorNearestVessel) { Vessel newVessel = Utils.GetNearestVessel(_minVesselDist, _maxVesselDist, v); if (NearestVessel != newVessel) { NearestVessel = newVessel; changed = true; } } } } else if (SoundtrackEditor.CurrentSituation.scene == Enums.Scenes.SpaceCentre) { if (MonitorTimeOfDay) { if (_homeBody == null) { _homeBody = FlightGlobals.GetHomeBody(); } double localTime = Sun.Instance.GetLocalTimeAtPosition(Utils.KscLatitude, Utils.KscLongitude, _homeBody); Enums.TimesOfDay tod = Enums.TimeToTimeOfDay(localTime); if (SoundtrackEditor.CurrentSituation.timeOfDay != tod) { SoundtrackEditor.CurrentSituation.timeOfDay = tod; changed = true; } } } else { SoundtrackEditor.CurrentSituation.paused = Enums.Selector.False; } if (changed) { SoundtrackEditor.Instance.OnSituationChanged(); } }