SetVariable() public method

public SetVariable ( string name, float value ) : void
name string
value float
return void
Esempio n. 1
0
 internal void INTERNAL_initCue(Cue newCue)
 {
     if (!cueInstanceCounts.ContainsKey(newCue.Name))
     {
         cueInstanceCounts.Add(newCue.Name, 0);
     }
     newCue.SetVariable("NumCueInstances", cueInstanceCounts[newCue.Name]);
     newCue.SetVariable("Volume", INTERNAL_volume.Value);
 }
Esempio n. 2
0
 internal bool INTERNAL_addCue(Cue newCue)
 {
     lock (activeCues)
     {
         if (activeCues.Count >= maxCueInstances)
         {
             if (maxCueBehavior == MaxInstanceBehavior.Fail)
             {
                 return(false);                        // Just ignore us...
             }
             else if (maxCueBehavior == MaxInstanceBehavior.Queue)
             {
                 newCue.SetVariable("Volume", 0.0f);
                 queuedCue.Value       = newCue;
                 fadingCue.Value       = activeCues[0];
                 fadingCueVolume.Value = activeCues[0].GetVariable("Volume");
                 fadeTimer.Reset();
                 fadeTimer.Start();
                 fading.Value = true;
             }
             else if (maxCueBehavior == MaxInstanceBehavior.ReplaceOldest)
             {
                 INTERNAL_removeOldestCue(activeCues[0].Name);
             }
             else if (maxCueBehavior == MaxInstanceBehavior.ReplaceQuietest)
             {
                 float lowestVolume = float.MaxValue;
                 int   lowestIndex  = -1;
                 for (int i = 0; i < activeCues.Count; i += 1)
                 {
                     if (activeCues[i].GetVariable("Volume") < lowestVolume)
                     {
                         lowestVolume = activeCues[i].GetVariable("Volume");
                         lowestIndex  = i;
                     }
                 }
                 if (lowestIndex > -1)
                 {
                     cueInstanceCounts[activeCues[lowestIndex].Name] -= 1;
                     activeCues[lowestIndex].Stop(AudioStopOptions.AsAuthored);
                 }
             }
             else if (maxCueBehavior == MaxInstanceBehavior.ReplaceLowestPriority)
             {
                 // FIXME: Priority?
                 INTERNAL_removeOldestCue(activeCues[0].Name);
             }
         }
         cueInstanceCounts[newCue.Name] += 1;
         newCue.SetVariable("NumCueInstances", cueInstanceCounts[newCue.Name]);
         activeCues.Add(newCue);
     }
     return(true);
 }
Esempio n. 3
0
 public void Stop(AudioStopOptions options)
 {
     while (activeCues.Count > 0)
     {
         Cue curCue = activeCues[0];
         curCue.Stop(options);
         curCue.SetVariable("NumCueInstances", 0);
         cueInstanceCounts[curCue.Name] -= 1;
     }
     activeCues.Clear();
 }
Esempio n. 4
0
 internal void INTERNAL_initCue(Cue newCue)
 {
     lock (activeCues)
     {
         if (!cueInstanceCounts.ContainsKey(newCue.Name))
         {
             cueInstanceCounts.Add(newCue.Name, 0);
         }
         newCue.SetVariable("NumCueInstances", cueInstanceCounts[newCue.Name]);
     }
 }
Esempio n. 5
0
		internal bool INTERNAL_addCue(Cue newCue)
		{
			lock (activeCues)
			{
				if (activeCues.Count >= maxCueInstances)
				{
					if (maxCueBehavior == MaxInstanceBehavior.Fail)
					{
						return false; // Just ignore us...
					}
					else if (maxCueBehavior == MaxInstanceBehavior.Queue)
					{
						newCue.INTERNAL_startFadeIn(maxFadeInMS);
						activeCues[0].INTERNAL_startFadeOut(maxFadeOutMS);
					}
					else if (maxCueBehavior == MaxInstanceBehavior.ReplaceOldest)
					{
						INTERNAL_removeOldestCue(activeCues[0].Name);
					}
					else if (maxCueBehavior == MaxInstanceBehavior.ReplaceQuietest)
					{
						float lowestVolume = float.MaxValue;
						int lowestIndex = -1;
						for (int i = 0; i < activeCues.Count; i += 1)
						{
							float vol = activeCues[i].INTERNAL_calculateVolume();
							if (vol < lowestVolume)
							{
								lowestVolume = vol;
								lowestIndex = i;
							}
						}
						if (lowestIndex > -1)
						{
							cueInstanceCounts[activeCues[lowestIndex].Name] -= 1;
							activeCues[lowestIndex].Stop(AudioStopOptions.AsAuthored);
						}
					}
					else if (maxCueBehavior == MaxInstanceBehavior.ReplaceLowestPriority)
					{
						// FIXME: Priority?
						INTERNAL_removeOldestCue(activeCues[0].Name);
					}
				}
				cueInstanceCounts[newCue.Name] += 1;
				newCue.SetVariable("NumCueInstances", cueInstanceCounts[newCue.Name]);
				activeCues.Add(newCue);
			}
			return true;
		}
Esempio n. 6
0
        public Player(Game1 game, Vector3 p, float s)
            : base(game)
        {
            this.game = game;
            MAX_SPEED = 10;
            theModel = game.Content.Load<Model>("Models\\Player\\ship");
            player_position = p;
            scale = s;

            funnelSmokePlume = new SmokePlumeParticleSystem(game, game.Content);
            funnelSmokePlume.DrawOrder=4;
            game.Components.Add(funnelSmokePlume);

            explosion = new ExplosionParticleSystem(game, game.Content);
            explosion.DrawOrder = 4;

            explosionSmoke = new ExplosionSmokeParticleSystem(game, game.Content);
            explosionSmoke.DrawOrder = 4;

            playerSfx = game.getSoundPlayer();
            trainSoundCue =  playerSfx.getCue("trainsSound");
            playerSfx.playCue(trainSoundCue);
            trainSoundCue.SetVariable("TrainSpeed", 0);
        }
Esempio n. 7
0
 internal void INTERNAL_addCue(Cue newCue)
 {
     cueInstanceCounts[newCue.Name] += 1;
     newCue.SetVariable("NumCueInstances", cueInstanceCounts[newCue.Name]);
     activeCues.Add(newCue);
 }
Esempio n. 8
0
        ///<summary>
        ///Start all tank engine sounds.
        ///</summary>
        public void StartAllSound()
        {
            if (_engineCue != null && !_engineCue.IsStopped)
            {
                _engineCue.Stop(AudioStopOptions.Immediate);
            }

            _engineCue = Program.SoundBank.GetCue("tankEngine");
            _engineCue.SetVariable("EngineSpeed", 0.0f);
            _engineCue.SetVariable("AngularSpeed", 0.0f);
            _engineCue.Play();
        }
Esempio n. 9
0
        public static void LoadSounds(ContentManager content)
        {
            _audioEngine = new AudioEngine(content.RootDirectory + "//BomberbroAudio.xgs");
            _waveBankTheme = new WaveBank(_audioEngine, content.RootDirectory + "//Theme.xwb");
            _soundBankTheme = new SoundBank(_audioEngine, content.RootDirectory + "//Theme.xsb");
            _waveBankSoundEffect = new WaveBank(_audioEngine, content.RootDirectory + "//SoundEffects.xwb");
            _soundBankSoundEffect = new SoundBank(_audioEngine, content.RootDirectory + "//SoundEffect.xsb");

            _currentSong = _soundBankTheme.GetCue("Theme");
            _explosion2 = _soundBankSoundEffect.GetCue("Explosion 2");
            _cancel1 = _soundBankSoundEffect.GetCue("Cancel 1");
            _cancel2 = _soundBankSoundEffect.GetCue("Cancel 2");
            _collision1 = _soundBankSoundEffect.GetCue("Collision 1");
            _collision2 = _soundBankSoundEffect.GetCue("Collision 2");
            _completeDead = _soundBankSoundEffect.GetCue("Complete-Dead");
            _explosion1 = _soundBankSoundEffect.GetCue("Explosion 1");
            _hit = _soundBankSoundEffect.GetCue("Hit");
            _marioCoin = _soundBankSoundEffect.GetCue("Mario Coin");
            _randomMelody1 = _soundBankSoundEffect.GetCue("Random Melody 1");
            _randomMelody2 = _soundBankSoundEffect.GetCue("Random Melody 2");
            _sfx1 = _soundBankSoundEffect.GetCue("SFX1");
            _thumbMove1 = _soundBankSoundEffect.GetCue("ThumbMove 1");

            MusicVolume = 0.5f;
            MusicPitch = 0.5f;
            _audioEngine.GetCategory("Music").SetVolume(_musicVolume);
            _currentSong.SetVariable("Pitch", _musicPitch);
        }