Example #1
0
 public ActiveSoundForObject([NotNull] ISoundEffectInstance soundEffectInstance, [NotNull] IGameObject gameObject, [NotNull] ICentrePointProvider centrePointProvider) : base(soundEffectInstance)
 {
     if (gameObject == null)
     {
         throw new ArgumentNullException(nameof(gameObject));
     }
     if (!gameObject.IsExtant)
     {
         throw new ArgumentException("GameObject is not extant.");
     }
     this._gameObject          = gameObject;
     this._centrePointProvider = centrePointProvider ?? throw new ArgumentNullException(nameof(centrePointProvider));
 }
Example #2
0
        private void InternalPlayForObject(GameSound gameSound, IGameObject gameObject, ICentrePointProvider centrePointProvider)
        {
#if DEBUG
            if (!DoesSoundRequirePosition(gameSound))
            {
                throw new ArgumentOutOfRangeException("GameSound " + gameSound + " should not be associated with a GameObject.");
            }
#endif

            ISoundEffectInstance soundEffect = this.SoundLibrary[gameSound];
            var activeSound = new ActiveSoundForObject(soundEffect, gameObject, centrePointProvider);
            this.ActiveSoundService.Add(activeSound);
        }
Example #3
0
        private void InternalPlay(GameSound gameSound)
        {
#if DEBUG
            if (DoesSoundRequirePosition(gameSound))
            {
                throw new ArgumentOutOfRangeException("GameSound " + gameSound + " needs to be associated with a GameObject.");
            }
#endif

            ISoundEffectInstance soundEffect = this.SoundLibrary[gameSound];
            var activeSound = new ActiveSound(soundEffect);
            this.ActiveSoundService.Add(activeSound);
        }
Example #4
0
 public ActiveSound([NotNull] ISoundEffectInstance soundEffectInstance)
 {
     this.SoundEffectInstance = soundEffectInstance ?? throw new ArgumentNullException(nameof(soundEffectInstance));
 }