Exemplo n.º 1
0
        /// <summary>
        /// Play audio using our data.
        /// </summary>
        /// <param name="parent">The Impact Object that created this result.</param>
        public void Process(IImpactObject parent)
        {
            this.parent = parent;
            audioSource = ImpactAudioPool.PlayAudio(this, OriginalData.Point, InteractionResultExtensions.GetPriority(OriginalData.PriorityOverride, parent));

            targetVolume = currentVolume = Volume;
            targetPitch  = currentPitch = Pitch;

            //Dispose immediately for Collision interaction types
            if (OriginalData.InteractionType == InteractionData.InteractionTypeCollision)
            {
                Dispose();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Stops the audio source associated with this result so it becomes available in the audio source object pool.
        /// </summary>
        public void Dispose()
        {
            if (OriginalData.InteractionType != InteractionData.InteractionTypeCollision && audioSource != null)
            {
                audioSource.StopAudio();
            }

            AudioSourceTemplate = null;
            audioSource         = null;
            AudioClip           = null;
            Interaction         = null;
            parent = null;

            MakeAvailable();
        }