示例#1
0
        public static IPattern STAMINA_PATTERN_4(double staminaChange)
        {
            if (staminaChange == 0)
            {
                return(new SimplePattern(STAMINA_MOTOR_NUMBER, new int[] { 2200 }, new double[] { 0.0 }));
            }
            bool ascending = staminaChange > 0;

            if (ascending)
            {
                SimplePattern p1      = new SimplePattern(STAMINA_MOTOR_NUMBER + 2 * STAMINA_MOTOR_DIRECTION, new int[] { 900 + 300 + 200 + 300, 200, 300 }, new double[] { 0.0, 1.0, 0.0 });
                SimplePattern p2      = new SimplePattern(STAMINA_MOTOR_NUMBER + 1 * STAMINA_MOTOR_DIRECTION, new int[] { 900 + 300, 200, 300 + 200 + 300 }, new double[] { 0.0, 1.0, 0.0 });
                SimplePattern p3      = new SimplePattern(STAMINA_MOTOR_NUMBER + 0 * STAMINA_MOTOR_DIRECTION, new int[] { 900, 300 + 200 + 300 + 200 + 300 }, new double[] { 1.0, 0.0 });
                MultiPattern  pattern = new MultiPattern(p1, p2, p3);
                return(pattern);
            }
            else
            {
                SimplePattern p1      = new SimplePattern(STAMINA_MOTOR_NUMBER + 2 * STAMINA_MOTOR_DIRECTION, new int[] { 900, 300 + 200 + 300 + 200 + 300 }, new double[] { 1.0, 0.0 });
                SimplePattern p2      = new SimplePattern(STAMINA_MOTOR_NUMBER + 1 * STAMINA_MOTOR_DIRECTION, new int[] { 900 + 300, 200, 300 + 200 + 300 }, new double[] { 0.0, 1.0, 0.0 });
                SimplePattern p3      = new SimplePattern(STAMINA_MOTOR_NUMBER + 0 * STAMINA_MOTOR_DIRECTION, new int[] { 900 + 300 + 200 + 300, 200, 300 }, new double[] { 0.0, 1.0, 0.0 });
                MultiPattern  pattern = new MultiPattern(p1, p2, p3);
                return(pattern);
            }
        }
示例#2
0
        public static IPattern HEALT_PATTERN_1d(double health, int vibrationDuration)
        {
            int bpm          = HealthToBPM(health);
            int intervalTime = (int)Math.Round((60.0 * 1000) / bpm);

            vibrationDuration = Math.Min(vibrationDuration, intervalTime);
            SimplePattern p1      = new SimplePattern(HEALTH_MOTOR_NUMBER + 3 * HEALTH_MOTOR_DIRECTION, new int[] { vibrationDuration, intervalTime * 3 - vibrationDuration }, new double[] { 1.0, 0.0 });
            SimplePattern p2      = new SimplePattern(HEALTH_MOTOR_NUMBER + 2 * HEALTH_MOTOR_DIRECTION, new int[] { intervalTime, vibrationDuration, intervalTime * 2 - vibrationDuration }, new double[] { 0.0, 1.0, 0.0 });
            SimplePattern p3      = new SimplePattern(HEALTH_MOTOR_NUMBER + 1 * HEALTH_MOTOR_DIRECTION, new int[] { intervalTime * 2, vibrationDuration, intervalTime - vibrationDuration }, new double[] { 0.0, 1.0, 0.0 });
            MultiPattern  pattern = new MultiPattern(p1, p2, p3);

            return(pattern);
        }
示例#3
0
        public static IPattern STAMINA_PATTERN_5(double staminaChange)
        {
            int t1       = 200;
            int t2       = 300;
            int t3       = 1300;
            int duration = t1 + t2 + t1 + t3;

            if (staminaChange == 0)
            {
                return(new SimplePattern(STAMINA_MOTOR_NUMBER, new int[] { duration }, new double[] { 0.0 }));
            }
            bool ascending = staminaChange > 0;

            if (ascending)
            {
                int           bumpDuration = (int)Math.Round((double)duration / 2);
                SimplePattern wave         = GetSineWavePattern(bumpDuration, 0, 1, -Math.PI / 2, bumpDuration, 100);
                wave.SetMotor(STAMINA_MOTOR_NUMBER + 2 * STAMINA_MOTOR_DIRECTION);
                SimplePattern p1 = ConcatenatePatterns(new SimplePattern(STAMINA_MOTOR_NUMBER + 2 * STAMINA_MOTOR_DIRECTION, new int[] { duration - bumpDuration }, new double[] { 0.0 }), wave.Copy());

                int           p2waitTime = (int)Math.Round(bumpDuration * 2.0 / 4);
                SimplePattern p2Wait     = new SimplePattern(STAMINA_MOTOR_NUMBER + 1 * STAMINA_MOTOR_DIRECTION, new int[] { p2waitTime }, new double[] { 0.0 });
                wave.SetMotor(STAMINA_MOTOR_NUMBER + 1 * STAMINA_MOTOR_DIRECTION);
                SimplePattern p2 = ConcatenatePatterns(p2Wait.Copy(), wave.Copy(), p2Wait.Copy());

                wave.SetMotor(STAMINA_MOTOR_NUMBER + 0 * STAMINA_MOTOR_DIRECTION);
                SimplePattern p3 = ConcatenatePatterns(wave.Copy(), new SimplePattern(STAMINA_MOTOR_NUMBER + 0 * STAMINA_MOTOR_DIRECTION, new int[] { duration - bumpDuration }, new double[] { 0.0 }));

                MultiPattern pattern = new MultiPattern(p1, p2, p3);
                return(pattern);
            }
            else
            {
                SimplePattern p1      = new SimplePattern(STAMINA_MOTOR_NUMBER + 2 * STAMINA_MOTOR_DIRECTION, new int[] { t1, t2 + t1 + t3 }, new double[] { 1.0, 0.0 });
                SimplePattern p2      = new SimplePattern(STAMINA_MOTOR_NUMBER + 1 * STAMINA_MOTOR_DIRECTION, new int[] { t1, t2, t1, t3 }, new double[] { 1.0, 0.0, 1.0, 0.0 });
                SimplePattern p3      = new SimplePattern(STAMINA_MOTOR_NUMBER + 0 * STAMINA_MOTOR_DIRECTION, new int[] { t1 + t2, t1, t3 }, new double[] { 0.0, 1.0, 0.0 });
                MultiPattern  pattern = new MultiPattern(p1, p2, p3);
                return(pattern);
            }
        }