Exemplo n.º 1
0
 static void SetWarpMode(TimeWarp.Modes mode)
 {
     if (TimeWarp.WarpMode != mode)
     {
         TimeWarp.fetch.Mode = mode;
         TimeWarp.SetRate(0, true);
     }
 }
Exemplo n.º 2
0
        // Return which of the two rates arrays is to be used for the given mode:
        private static float[] GetRateArrayForMode(TimeWarp.Modes whichMode)
        {
            switch (whichMode)
            {
            case TimeWarp.Modes.HIGH:
                return(TimeWarp.fetch.warpRates);

            case TimeWarp.Modes.LOW:
                return(TimeWarp.fetch.physicsWarpRates);
            }

            return(new float[0]);
        }
Exemplo n.º 3
0
        public ListValue <ScalarValue> GetRatesList(TimeWarp.Modes warpMode)
        {
            float[] ratesArray = GetRateArrayForMode(warpMode);

            ListValue <ScalarValue> ratesKOSList = new ListValue <ScalarValue>();

            // Have to convert the elements one at a time from (float) to (ScalarDoubleValue):
            foreach (float val in ratesArray)
            {
                ratesKOSList.Add(val);
            }

            return(ratesKOSList);
        }
Exemplo n.º 4
0
        // Return which of the two rates arrays is to be used for the given mode:
        private float[] GetRateArrayForMode(TimeWarp.Modes whichMode)
        {
            float[] rateArray;
            switch (whichMode)
            {
            case TimeWarp.Modes.HIGH:
                rateArray = TimeWarp.fetch.warpRates;
                break;

            case TimeWarp.Modes.LOW:
                rateArray = TimeWarp.fetch.physicsWarpRates;
                break;

            default:
                throw new Exception(string.Format("WARP MODE {0} unknown to kOS - did KSP's API change?", TimeWarp.WarpMode.ToString()));
            }
            return(rateArray);
        }
Exemplo n.º 5
0
 static void SetWarpFactor(TimeWarp.Modes mode, int factor)
 {
     SetWarpMode(mode);
     TimeWarp.SetRate(factor, false);
 }