Exemple #1
0
        /// <summary>
        /// When the user clicks the pointer (select button) or air-taps on the object,
        /// change the filter setting and the material.
        /// </summary>
        public void OnPointerClicked(MixedRealityPointerEventData eventData)
        {
            // Only proceed if the effect script is attached.
            if (loFiEffect == null)
            {
                return;
            }

            // Get the current source quality setting.
            AudioLoFiSourceQualityType sourceQuality = loFiEffect.SourceQuality;

            // Select a new source quality setting.
            switch (sourceQuality)
            {
            case AudioLoFiSourceQualityType.NarrowBandTelephony:
                sourceQuality = AudioLoFiSourceQualityType.AmRadio;
                break;

            case AudioLoFiSourceQualityType.AmRadio:
                sourceQuality = AudioLoFiSourceQualityType.FullRange;
                break;

            case AudioLoFiSourceQualityType.FullRange:
                sourceQuality = AudioLoFiSourceQualityType.NarrowBandTelephony;
                break;
            }

            // Update the material to match the new source quality.
            SetEmitterMaterial(sourceQuality);

            // Update the source quality.
            loFiEffect.SourceQuality = sourceQuality;
        }
Exemple #2
0
        /// <summary>
        /// Sets the appropriate material based on the source quality setting.
        /// </summary>
        /// <param name="sourceQuality">The source quality used to determine the appropriate material.</param>
        private void SetEmitterMaterial(AudioLoFiSourceQualityType sourceQuality)
        {
            Material emitterMaterial = UnknownQuality;

            // Determine the material for the emitter based on the source quality.
            switch (sourceQuality)
            {
            case AudioLoFiSourceQualityType.NarrowBandTelephony:
                emitterMaterial = NarrowBandTelephony;
                break;

            case AudioLoFiSourceQualityType.AmRadio:
                emitterMaterial = AmRadio;
                break;

            case AudioLoFiSourceQualityType.FullRange:
                emitterMaterial = FullRange;
                break;
            }

            // Set the material on the emitter.
            objectRenderer.sharedMaterial = emitterMaterial;
        }