public StateTracker() { this.launchStateTimer = new GameStateTimer(scene => HighLogic.LoadedSceneIsGame && FlightGlobals.ActiveVessel != null, scene => !FlightGlobals.ActiveVessel.Landed && !FlightGlobals.ActiveVessel.Splashed); this.landedStateTimer = GameStateTimer.Inverse(launchStateTimer); this.buildingStateTimer = new GameStateTimer(scene => true, scene => scene == GameScenes.EDITOR); this.idleStateTimer = new GameStateTimer(scene => true, scene => scene != GameScenes.EDITOR && scene != GameScenes.FLIGHT); UpdateTimers(); }
public static GameStateTimer Inverse(GameStateTimer timer) { return(new GameStateTimer(timer.preconditions, scene => !timer.checkActive.Invoke(scene))); }