コード例 #1
0
    void FixedUpdate()
    {
        if (Play)
        {
            if (!VOManager.Instance.IsPlaying())
            {
                if (collectableName != null && !collectableGiven)
                {
                    CT.addCollectable(collectableName, false);
                }
                if (_intCurrentIndex < AudioClipIDs.Length)
                {
                    // if the delay rate between the audio files is 0
                    if (_fltDelayBetweenAudio <= 0)
                    {
                        // play the audio at the audio source and increment the index
                        VOManager.Instance.Play(AS, AudioClipIDs[_intCurrentIndex]);
                        // print(_intCurrentIndex);
                        _intCurrentIndex++;


                        // reset the delay rate
                        _fltDelayBetweenAudio = fltDelayBetweenAudio;
                    }
                    else
                    {
                        // decrease the delay rate based on delta time
                        _fltDelayBetweenAudio -= Time.fixedDeltaTime;
                    }
                }
                else
                {
                    // turn off the audio triggers
                    //TurnOffAllTriggers();
                    _intCurrentIndex = 0;
                    this.enabled     = false;
                }
            }
        }
    }
コード例 #2
0
ファイル: Collectable.cs プロジェクト: Rixic/Temporal
    // Update is called once per frame
    void Update()
    {
        //if (Input.GetKeyDown (KeyCode.Escape))
        //{
        //   Cursor.lockState = CursorLockMode.None;

        //}
        if (displayInfo && Input.GetKeyDown(KeyCode.E) && (!VOManager.Instance.IsPlaying()))
        {
            Playing = true;
            AS.PlayOneShot(InteractionSound, 1f);
            CT.addCollectable(collectableName);
            if (InteractOnce)
            {
                this.gameObject.GetComponent <MeshRenderer>().enabled = false;
                InteractionOccured = true;
                if (PTHenabled)
                {
                    PTH.CompleteTrigger(PTHid, true);
                }
            }
        }

        if (Playing)
        {
            //AS.PlayOneShot(AudioClip, 1f);

            if (!VOManager.Instance.IsPlaying())
            {
                // if the current index is less than the list length
                if (m_intCurrentIndex < AudioClipIDs.Length)
                {
                    // if the delay rate between the audio files is 0
                    if (m_fltDelayBetweenAudio <= 0)
                    {
                        // play the audio at the audio source and increment the index
                        VOManager.Instance.Play(AS, AudioClipIDs[m_intCurrentIndex]);
                        print(m_intCurrentIndex);
                        m_intCurrentIndex++;

                        // reset the delay rate
                        m_fltDelayBetweenAudio = fltDelayBetweenAudio;
                    }
                    else
                    {
                        // decrease the delay rate based on delta time
                        m_fltDelayBetweenAudio -= Time.deltaTime;
                    }
                }
                else
                {
                    // turn off the audio triggers
                    //TurnOffAllTriggers();
                    m_intCurrentIndex = 0;
                    Playing           = false;
                }
            }
        }


        FadeText();
        if (displayInfo)
        {
            displayInfo = false;
        }
    }