示例#1
0
    // Update is called once per frame
    void OnTriggerStay(Collider col)
    {
        if (col.tag == "Player" && GlobalFuncVari.getTutorialSkipped() != true && tutorialPlayed == false && startedPlaying == false)
        {
            movementScript.enabled = false;
            boostScript.enabled    = false;
            jumpScript.enabled     = false;
            tutorialEvent          = soundEmitter.startEvent(tutorialSound, false);
            textureDisplay.tutorialTexture(tutorialHint);
            startedPlaying = true;
        }

        if (col.tag == "Player" && startedPlaying == true)
        {
            tutorialEventState = soundEmitter.eventState(tutorialEvent);
            if (tutorialEventState != PLAYBACK_STATE.PLAYING)
            {
                movementScript.enabled = true;
                boostScript.enabled    = true;
                jumpScript.enabled     = true;
                tutorialPlayed         = true;
                //textureDisplay.tutorialTexture(null);
                Debug.Log("LOL");
            }
            if (Input.GetButtonDown("Cancel"))
            {
                GlobalFuncVari.setTutorialSkipped(true);
                soundEmitter.stopEvent(tutorialEvent);
                //textureDisplay.tutorialTexture(null);
                movementScript.enabled = true;
                boostScript.enabled    = true;
                jumpScript.enabled     = true;
            }
        }
    }
示例#2
0
    public FMOD.Studio.PLAYBACK_STATE getPlaybackState()
    {
        if (m_Event == null || !m_Event.isValid())
        {
            return(FMOD.Studio.PLAYBACK_STATE.STOPPED);
        }

        FMOD.Studio.PLAYBACK_STATE state = PLAYBACK_STATE.IDLE;

        if (ERRCHECK(m_Event.getPlaybackState(out state)) == FMOD.RESULT.OK)
        {
            return(state);
        }
        return(FMOD.Studio.PLAYBACK_STATE.STOPPED);
    }
示例#3
0
        void Update()
        {
            if (studioSystem.isValid())
            {
                studioSystem.update();

                bool foundListener   = false;
                bool hasAllListeners = false;
                int  numListeners    = 0;
                for (int i = FMOD.CONSTANTS.MAX_LISTENERS - 1; i >= 0; i--)
                {
                    if (!foundListener && HasListener[i])
                    {
                        numListeners    = i + 1;
                        foundListener   = true;
                        hasAllListeners = true;
                    }

                    if (!HasListener[i] && foundListener)
                    {
                        hasAllListeners = false;
                    }
                }

                if (foundListener)
                {
                    studioSystem.setNumListeners(numListeners);
                }

                if (!hasAllListeners && !listenerWarningIssued)
                {
                    listenerWarningIssued = true;
                    UnityEngine.Debug.LogWarning("FMOD Studio Integration: Please add an 'FMOD Studio Listener' component to your a camera in the scene for correct 3D positioning of sounds");
                }

                for (int i = 0; i < attachedInstances.Count; i++)
                {
                    FMOD.Studio.PLAYBACK_STATE playbackState = FMOD.Studio.PLAYBACK_STATE.STOPPED;
                    attachedInstances[i].instance.getPlaybackState(out playbackState);
                    if (!attachedInstances[i].instance.isValid() ||
                        playbackState == FMOD.Studio.PLAYBACK_STATE.STOPPED ||
                        attachedInstances[i].transform == null // destroyed game object
                        )
                    {
                        attachedInstances.RemoveAt(i);
                        i--;
                        continue;
                    }

                    if (attachedInstances[i].rigidBody)
                    {
                        attachedInstances[i].instance.set3DAttributes(RuntimeUtils.To3DAttributes(attachedInstances[i].transform, attachedInstances[i].rigidBody));
                    }
                    else
                    {
                        attachedInstances[i].instance.set3DAttributes(RuntimeUtils.To3DAttributes(attachedInstances[i].transform, attachedInstances[i].rigidBody2D));
                    }
                }

                #if UNITY_EDITOR
                MuteAllEvents(UnityEditor.EditorUtility.audioMasterMute);

                for (int i = eventPositionWarnings.Count - 1; i >= 0; i--)
                {
                    if (eventPositionWarnings[i].isValid())
                    {
                        FMOD.ATTRIBUTES_3D attribs;
                        eventPositionWarnings[i].get3DAttributes(out attribs);
                        if (attribs.position.x == 1e+18F &&
                            attribs.position.y == 1e+18F &&
                            attribs.position.z == 1e+18F)
                        {
                            string path;
                            FMOD.Studio.EventDescription desc;
                            eventPositionWarnings[i].getDescription(out desc);
                            desc.getPath(out path);
                            Debug.LogWarningFormat("FMOD Studio: Instance of Event {0} has not had EventInstance.set3DAttributes() called on it yet!", path);
                        }
                    }
                    eventPositionWarnings.RemoveAt(i);
                }
                #endif
            }
        }