Exemple #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public AbstractForceController()
            : base(ControllerType.AbstractForceController)
        {
            Enabled = true;

            Strength      = 1.0f;
            Position      = new TSVector2(0, 0);
            MaximumSpeed  = 100.0f;
            TimingMode    = TimingModes.Switched;
            ImpulseTime   = 0.0f;
            ImpulseLength = 1.0f;
            Triggered     = false;
            StrengthCurve = new Curve();
            Variation     = 0.0f;
            Randomize     = TrueSync.TSRandom.New(1234);
            DecayMode     = DecayModes.None;
            DecayCurve    = new Curve();
            DecayStart    = 0.0f;
            DecayEnd      = 0.0f;

            StrengthCurve.Keys.Add(new CurveKey(0, 5));
            StrengthCurve.Keys.Add(new CurveKey(0.1f, 5));
            StrengthCurve.Keys.Add(new CurveKey(0.2f, -4));
            StrengthCurve.Keys.Add(new CurveKey(1f, 0));
        }
Exemple #2
0
        private static void Shuffle <T>(IList <T> list)
        {
            TrueSync.TSRandom rng = TrueSync.TSRandom.New(0);
            int n = list.Count;

            while (n > 1)
            {
                n--;
                int k     = rng.Next(0, n + 1);
                T   value = list[k];
                list[k] = list[n];
                list[n] = value;
            }
        }