예제 #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));
 }
예제 #2
0
 public static void SetCentrePointProvider(ICentrePointProvider centrePointProvider)
 {
     CentrePointProvider = centrePointProvider;
 }
예제 #3
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);
        }
예제 #4
0
        public void PlayForObjectWithCallback(GameSound gameSound, [NotNull] IGameObject gameObject, [NotNull] ICentrePointProvider centrePointProvider, [NotNull] EventHandler callback)
        {
            if (gameObject == null)
            {
                throw new ArgumentNullException(nameof(gameObject));
            }
            if (centrePointProvider == null)
            {
                throw new ArgumentNullException(nameof(centrePointProvider));
            }
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            InternalPlayForObject(gameSound, gameObject, centrePointProvider);
            AddCallback(gameSound, callback);
        }
예제 #5
0
        public void PlayForObject(GameSound gameSound, [NotNull] IGameObject gameObject, [NotNull] ICentrePointProvider centrePointProvider)
        {
            if (gameObject == null)
            {
                throw new ArgumentNullException(nameof(gameObject));
            }
            if (centrePointProvider == null)
            {
                throw new ArgumentNullException(nameof(centrePointProvider));
            }

            InternalPlayForObject(gameSound, gameObject, centrePointProvider);
        }
예제 #6
0
 public void PlayForObjectWithCallback(GameSound gameSound, IGameObject gameObject, ICentrePointProvider centrePointProvider, EventHandler callback)
 {
     // nothing to do
 }
예제 #7
0
 public void PlayForObject(GameSound gameSound, IGameObject gameObject, ICentrePointProvider centrePointProvider)
 {
     // nothing to do
 }