public void removeSound(bool coaster, bool intern, bool reverse, bool idle, bool limiter, int i) { if (intern) { // internal if (idle) { IntIdleSnd = null; } else if (reverse) { IntReverseSnd = null; } else if (limiter) { IntLimiterSnd = null; } else if (coaster) { var tmp = IntCoasterSnd.ToList(); tmp.RemoveAt(i); IntCoasterSnd = tmp.ToArray(); } else { var tmp = IntPowerSnd.ToList(); tmp.RemoveAt(i); IntPowerSnd = tmp.ToArray(); } } else { // external if (idle) { ExtIdleSnd = null; } if (reverse) { ExtReverseSnd = null; } else if (limiter) { ExtLimiterSnd = null; } else if (coaster) { var tmp = ExtCoasterSnd.ToList(); tmp.RemoveAt(i); ExtCoasterSnd = tmp.ToArray(); } else { var tmp = ExtPowerSnd.ToList(); tmp.RemoveAt(i); ExtPowerSnd = tmp.ToArray(); } } }
public void addSound(bool coaster, bool intern, bool reverse, bool idle, bool limiter) { if (intern) { // internal if (idle) { IntIdleSnd = new CarSoundItem(); } else if (reverse) { IntReverseSnd = new CarSoundItem(); } else if (limiter) { IntLimiterSnd = new CarSoundItem(); } else if (coaster) { System.Array.Resize(ref IntCoasterSnd, IntCoasterSnd.Length + 1); IntCoasterSnd[IntCoasterSnd.Length - 1] = new CarSoundItem(); } else { System.Array.Resize(ref IntPowerSnd, IntPowerSnd.Length + 1); IntPowerSnd[IntPowerSnd.Length - 1] = new CarSoundItem(); } } else { // external if (idle) { ExtIdleSnd = new CarSoundItem(); } if (reverse) { ExtReverseSnd = new CarSoundItem(); } else if (limiter) { ExtLimiterSnd = new CarSoundItem(); } else if (coaster) { System.Array.Resize(ref ExtCoasterSnd, ExtCoasterSnd.Length + 1); ExtCoasterSnd[ExtCoasterSnd.Length - 1] = new CarSoundItem(); } else { System.Array.Resize(ref ExtPowerSnd, ExtPowerSnd.Length + 1); ExtPowerSnd[ExtPowerSnd.Length - 1] = new CarSoundItem(); } } }