Beispiel #1
0
 /// <summary>
 /// Sets the value of a cue-instance variable based on its friendly name.
 /// </summary>
 /// <param name="name">Friendly name of the variable to set.</param>
 /// <param name="value">Value to assign to the variable.</param>
 /// <remarks>The friendly name is a value set from the designer.</remarks>
 public void SetVariable(string name, float value)
 {
     if (name == "Volume")
     {
         _volume = value;
         if (_curSound != null)
         {
             _curSound.SetCueVolume(_volume);
         }
     }
     else
     {
         _engine.SetGlobalVariable(name, value);
     }
 }
Beispiel #2
0
        /// <summary>Requests playback of a prepared or preparing Cue.</summary>
        /// <remarks>Calling Play when the Cue already is playing can result in an InvalidOperationException.</remarks>
        public void Play()
        {
            if (!_engine._activeCues.Contains(this))
            {
                _engine._activeCues.Add(this);
            }

            //TODO: Probabilities
            var index = XactHelpers.Random.Next(_sounds.Length);

            _curSound = _sounds[index];

            _curSound.SetCueVolume(_volume);
            _curSound.Play();
        }
Beispiel #3
0
        /// <summary>Requests playback of a prepared or preparing Cue.</summary>
        /// <remarks>Calling Play when the Cue already is playing can result in an InvalidOperationException.</remarks>
		public void Play()
		{
            if (!_engine._activeCues.Contains(this))
                _engine._activeCues.Add(this);
			
			//TODO: Probabilities
            var index = XactHelpers.Random.Next(_sounds.Length);
            _curSound = _sounds[index];
			
			_curSound.SetCueVolume(_volume);
			_curSound.Play();
		}