public void RemoveTaxi(Taxi taxi) { SoundEffectInstance engineInstance = engines[taxi]; engineInstance.Stop(); engineInstance.Dispose(); engines.Remove(taxi); SoundEffectInstance scratchInstance = scratches[taxi]; scratchInstance.Stop(); scratchInstance.Dispose(); scratches.Remove(taxi); }
public void AddTaxi(Taxi taxi) { SoundEffectInstance engineInstance = engine.CreateInstance(); engineInstance.IsLooped = true; engineInstance.Volume = 0f; engineInstance.Play(); engines.Add(taxi, engineInstance); SoundEffectInstance scratchInstance = scratch.CreateInstance(); scratchInstance.IsLooped = true; scratchInstance.Volume = 0f; scratchInstance.Play(); scratches.Add(taxi, scratchInstance); }
protected override void LoadContent() { Window.Position = new Point(10, 50); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); background = Content.Load<Texture2D>("Textures/background"); stone = Content.Load<Texture2D>("Textures/stone"); eva = Content.Load<Texture2D>("Textures/eva"); pix = Content.Load<Texture2D>("Textures/pix"); taxiSign = Content.Load<Texture2D>("Textures/taxisign"); flag = Content.Load<Texture2D>("Textures/flag"); hudFont = Content.Load<SpriteFont>("HudFont"); taxiTextures.Add(Content.Load<Texture2D>("Textures/taxi_blue")); taxiTextures.Add(Content.Load<Texture2D>("Textures/taxi_red")); taxiTextures.Add(Content.Load<Texture2D>("Textures/taxi_yellow")); taxiTextures.Add(Content.Load<Texture2D>("Textures/taxi_green")); playerColor.Add(Color.Blue); playerColor.Add(Color.Red); playerColor.Add(Color.Yellow); playerColor.Add(Color.Green); Random rand = new Random(); Texture2D buffer; Color colorBuffer; for (int i = 0; i < 100; i++) { int from = rand.Next(0, 4); int to = rand.Next(0, 4); buffer = taxiTextures[from]; taxiTextures[from] = taxiTextures[to]; taxiTextures[to] = buffer; colorBuffer = playerColor[from]; playerColor[from] = playerColor[to]; playerColor[to] = colorBuffer; } Taxi taxi1 = new Taxi(new LocalInput(LocalInputType.GamePad1)); taxi1.Position = level.GetTaxiSpawn(); taxis.Add(taxi1); sound.AddTaxi(taxi1); Taxi taxi2 = new Taxi(new LocalInput(LocalInputType.Keyboard1)); taxi2.Position = level.GetTaxiSpawn(); taxis.Add(taxi2); sound.AddTaxi(taxi2); }
internal void SetScratchVolume(Taxi taxi, float volume) { scratches[taxi].Volume = volume; }
internal void SetScratchPitch(Taxi taxi, float pitch) { scratches[taxi].Pitch = pitch; }
internal void SetEngineVolume(Taxi taxi, float volume) { engines[taxi].Volume = volume; }