/// <summary> /// Creates a new WarpWatch, starts it, and returns the current instance /// </summary> public static WarpWatch StartNew() { WarpWatch watch = new WarpWatch(); watch.Start(); return(watch); }
//Checks if there is a timer and/or a mustGoDown clause active public void CheckForWait() { bool timerSpent = true, goesDown = true; //Timer if (timer > 0 && deploymentTimer.elapsed.TotalSeconds < timer) { timerSpent = false; if (!deploymentTimer.isRunning) { deploymentTimer.Start(); } if (this.vessel.isActiveVessel) { float time = timer - (float)deploymentTimer.elapsed.TotalSeconds; if (time < 60) { ScreenMessages.PostScreenMessage(String.Format("Deployment in {0:0.0}s", time), Time.fixedDeltaTime, ScreenMessageStyle.UPPER_CENTER); } else { ScreenMessages.PostScreenMessage(String.Format("Deployment in {0}", RCUtils.ToMinutesSeconds(time)), Time.fixedDeltaTime, ScreenMessageStyle.UPPER_CENTER); } } } else if (deploymentTimer.isRunning) { deploymentTimer.Stop(); } //Goes down if (mustGoDown && this.vessel.verticalSpeed >= 0) { goesDown = false; if (this.vessel.isActiveVessel) { ScreenMessages.PostScreenMessage("Deployment awaiting negative vertical velocity", Time.fixedDeltaTime, ScreenMessageStyle.UPPER_CENTER); ScreenMessages.PostScreenMessage(String.Format("Current vertical velocity: {0:0.0}/s", this.vessel.verticalSpeed), Time.fixedDeltaTime, ScreenMessageStyle.UPPER_CENTER); } } //Can deploy or not if (timerSpent && goesDown) { wait = false; showDisarm = false; deploymentTimer.Reset(); } else { this.part.stackIcon.SetIconColor(XKCDColors.LightCyan); wait = true; showDisarm = true; } }
/// <summary> /// Creates a new WarpWatch, starts it, and returns the current instance /// </summary> public static WarpWatch StartNew() { WarpWatch watch = new WarpWatch(); watch.Start(); return watch; }