Exemple #1
0
        /// <summary>
        /// Creates a new PhysicsWatch from a certain amount of time, starts it, and returns the current instance
        /// </summary>
        /// <param name="seconds">Time to start the watch at, in seconds</param>
        public static PhysicsWatch StartNewFromTime(double seconds)
        {
            PhysicsWatch watch = new PhysicsWatch(seconds);

            watch.Start();
            return(watch);
        }
Exemple #2
0
        /// <summary>
        /// Creates a new PhysicsWatch, starts it, and returns the current instance
        /// </summary>
        public static PhysicsWatch StartNew()
        {
            PhysicsWatch watch = new PhysicsWatch();

            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;
            }
        }
Exemple #4
0
 /// <summary>
 /// Creates a new PhysicsWatch from a certain amount of time, starts it, and returns the current instance
 /// </summary>
 /// <param name="seconds">Time to start the watch at, in seconds</param>
 public static PhysicsWatch StartNewFromTime(double seconds)
 {
     PhysicsWatch watch = new PhysicsWatch(seconds);
     watch.Start();
     return watch;
 }
Exemple #5
0
 /// <summary>
 /// Creates a new PhysicsWatch, starts it, and returns the current instance
 /// </summary>
 public static PhysicsWatch StartNew()
 {
     PhysicsWatch watch = new PhysicsWatch();
     watch.Start();
     return watch;
 }