public static IPattern HEALT_PATTERN_3(double health, SimplePattern pattern) { SimplePattern copy = pattern.Copy(); copy.SetMotor(HEALTH_MOTOR_NUMBER); if (health > 0.75) { return(copy); } else if (health > 0.5) { SimplePattern copy2 = copy.Copy(); copy2.SetMotor(HEALTH_MOTOR_NUMBER + 1 * HEALTH_MOTOR_DIRECTION); return(new MultiPattern(copy, copy2)); } else if (health > 0.25) { SimplePattern copy2 = copy.Copy(); copy2.SetMotor(HEALTH_MOTOR_NUMBER + 1 * HEALTH_MOTOR_DIRECTION); SimplePattern copy3 = copy.Copy(); copy3.SetMotor(HEALTH_MOTOR_NUMBER + 2 * HEALTH_MOTOR_DIRECTION); return(new MultiPattern(copy, copy2, copy3)); } else { SimplePattern copy2 = copy.Copy(); copy2.SetMotor(HEALTH_MOTOR_NUMBER + 1 * HEALTH_MOTOR_DIRECTION); SimplePattern copy3 = copy.Copy(); copy3.SetMotor(HEALTH_MOTOR_NUMBER + 2 * HEALTH_MOTOR_DIRECTION); SimplePattern copy4 = copy.Copy(); copy4.SetMotor(HEALTH_MOTOR_NUMBER + 3 * HEALTH_MOTOR_DIRECTION); return(new MultiPattern(copy, copy2, copy3, copy4)); } }
public static SimplePattern STAMINA_PATTERN_1(double stamina) { int bpm = StaminaToBPM(stamina); int intervalTime = (int)Math.Round((60.0 * 1000) / bpm); SimplePattern pattern = GetSineWavePattern(intervalTime, 0.01, 1, -Math.PI / 2, intervalTime, 50); pattern.SetMotor(STAMINA_MOTOR_NUMBER); return(pattern); }
public static SimplePattern HEALT_PATTERN_1c(double health) { int bpm = HealthToBPM(health); int intervalTime = (int)Math.Round((60.0 * 1000) / bpm); SimplePattern pattern = GetSineWavePattern(intervalTime, 0.01, 1, -Math.PI / 2, intervalTime, 50); pattern.SetMotor(HEALTH_MOTOR_NUMBER); return(pattern); }
public static SimplePattern HEALT_PATTERN_1b(double health, int vibrationDuration) { int bpm = HealthToBPM(health); int intervalTime = (int)Math.Round((60.0 * 1000) / bpm); vibrationDuration = Math.Min(vibrationDuration, intervalTime); SimplePattern wave = GetSineWavePattern(vibrationDuration * 2, 0, 1, 0, vibrationDuration, 50); SimplePattern pattern = ConcatenatePatterns(wave, new SimplePattern(new int[] { intervalTime - vibrationDuration }, new double[] { 0.0 })); pattern.SetMotor(HEALTH_MOTOR_NUMBER); return(pattern); }
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); } }
public static IPattern AMMO_PATTERN_3l(double ammoLevel, SimplePattern pattern) { SimplePattern result = pattern.Copy(); if (ammoLevel > 3.0 / 4) { result.SetMotor(AMMO_MOTOR_NUMBER + 0 * AMMO_MOTOR_DIRECTION); } else if (ammoLevel > 2.0 / 4) { result.SetMotor(AMMO_MOTOR_NUMBER + 1 * AMMO_MOTOR_DIRECTION); } else if (ammoLevel > 1.0 / 4) { result.SetMotor(AMMO_MOTOR_NUMBER + 2 * AMMO_MOTOR_DIRECTION); } else { result.SetMotor(AMMO_MOTOR_NUMBER + 3 * AMMO_MOTOR_DIRECTION); } return(result); }
public static IPattern AMMO_PATTERN_9(double ammoLevel, int vibrationDuration) { int numOfLevels = 4; int ammoLvl = (int)Math.Max(Math.Ceiling(ammoLevel * numOfLevels), 1); SimplePattern result = SimpleVibrations(AMMO_MOTOR_NUMBER, vibrationDuration, 100, ammoLvl); if (ammoLevel > 3.0 / 4) { result.SetMotor(AMMO_MOTOR_NUMBER + 3 * AMMO_MOTOR_DIRECTION); } else if (ammoLevel > 2.0 / 4) { result.SetMotor(AMMO_MOTOR_NUMBER + 2 * AMMO_MOTOR_DIRECTION); } else if (ammoLevel > 1.0 / 4) { result.SetMotor(AMMO_MOTOR_NUMBER + 1 * AMMO_MOTOR_DIRECTION); } else { result.SetMotor(AMMO_MOTOR_NUMBER + 0 * AMMO_MOTOR_DIRECTION); } return(result); }
public static IPattern AMMO_PATTERN_4l(double ammoLevel, SimplePattern pattern) { if (ammoLevel > 3.0 / 4) { SimplePattern copy = pattern.Copy(); copy.SetMotor(AMMO_MOTOR_NUMBER + 0 * AMMO_MOTOR_DIRECTION); return(copy); } else if (ammoLevel > 2.0 / 4) { SimplePattern copy = pattern.Copy(); copy.SetMotor(AMMO_MOTOR_NUMBER + 0 * AMMO_MOTOR_DIRECTION); SimplePattern copy2 = pattern.Copy(); copy2.SetMotor(AMMO_MOTOR_NUMBER + 1 * AMMO_MOTOR_DIRECTION); return(new MultiPattern(copy, copy2)); } else if (ammoLevel > 1.0 / 4) { SimplePattern copy = pattern.Copy(); copy.SetMotor(AMMO_MOTOR_NUMBER + 0 * AMMO_MOTOR_DIRECTION); SimplePattern copy2 = pattern.Copy(); copy2.SetMotor(AMMO_MOTOR_NUMBER + 1 * AMMO_MOTOR_DIRECTION); SimplePattern copy3 = pattern.Copy(); copy3.SetMotor(AMMO_MOTOR_NUMBER + 2 * AMMO_MOTOR_DIRECTION); return(new MultiPattern(copy, copy2, copy3)); } else { SimplePattern copy = pattern.Copy(); copy.SetMotor(AMMO_MOTOR_NUMBER + 0 * AMMO_MOTOR_DIRECTION); SimplePattern copy2 = pattern.Copy(); copy2.SetMotor(AMMO_MOTOR_NUMBER + 1 * AMMO_MOTOR_DIRECTION); SimplePattern copy3 = pattern.Copy(); copy3.SetMotor(AMMO_MOTOR_NUMBER + 2 * AMMO_MOTOR_DIRECTION); SimplePattern copy4 = pattern.Copy(); copy4.SetMotor(AMMO_MOTOR_NUMBER + 3 * AMMO_MOTOR_DIRECTION); return(new MultiPattern(copy, copy2, copy3, copy4)); } }