예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (!gc.SceneComplete())
     {
         if (flag)
         {
             StartCoroutine("StopTurning");
             src.Play();
             flag = false;
         }
         if (turning)
         {
             transform.Rotate(Vector3.right * Time.deltaTime * speed);
         }
     }
     else
     {
         if (!reset)
         {
             transform.rotation = originalRotation;
             StopCoroutine("StopTurning");
             reset = true;
         }
         src.Stop();
     }
 }
예제 #2
0
    IEnumerator PlayRoutine()
    {
        isPlaying = true;
        source.Play();
        float peakVol = source.volume;

        for (float time = 0f; time < openingDuration; time += Time.deltaTime)
        {
            float ratio = time / openingDuration;
            ratio         = openingCurve.Evaluate(ratio);
            source.volume = Mathf.Lerp(0, peakVol, ratio);
            yield return(null);
        }
        source.volume = peakVol;
        if (!source.loop || closeAfterClipLength)
        {
            yield return(new WaitForSeconds(clipLength - openingDuration - closingDuration));

            for (float time = 0f; time < closingDuration; time += Time.deltaTime)
            {
                float ratio = time / closingDuration;
                ratio         = closingCurve.Evaluate(ratio);
                source.volume = Mathf.Lerp(peakVol, 0f, ratio);
                yield return(null);
            }
            source.volume = 0f;
            isPlaying     = false;
            source.Stop();
        }
    }
예제 #3
0
	// Use this for initialization
	void Start ()
    {
        CAS = GetComponent<CardboardAudioSource>();

        CAS.Stop();
        CAS.clip = AudioClips[Random.Range(0, AudioClips.Count)];
        CAS.Play();
	}
예제 #4
0
    // Use this for initialization
    void Start ()
    {
        CAS = GetComponent<CardboardAudioSource>();

        Player = Camera.main.gameObject;
        
        CAS.Stop();
        CAS.clip = IntroClips[m_curClipIndex];
        CAS.Play();
	}
예제 #5
0
 // Update is called once per frame
 void Update()
 {
     if (gc.ActiveBell() && gc.GetInteractionKey() && gazedAt &&
         Vector3.Distance(transform.position, player.transform.position) < interactionDistance)
     {
         gc.bell = true;
         src.Play();
     }
     if (gc.SceneComplete())
     {
         src.Stop();
     }
 }