// 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(); } }
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(); } }
public void BeginReading () { src = GetComponent<CardboardAudioSource> (); gc = (GameController) FindObjectOfType(typeof(GameController)); lc = (LightController) FindObjectOfType(typeof(LightController)); src.Play (); lc.holy = true; StartCoroutine ("FinishReading"); }
// Use this for initialization void Start () { CAS = GetComponent<CardboardAudioSource>(); CAS.Stop(); CAS.clip = AudioClips[Random.Range(0, AudioClips.Count)]; CAS.Play(); }
public void BeginReading() { src = GetComponent <CardboardAudioSource> (); gc = (GameController)FindObjectOfType(typeof(GameController)); lc = (LightController)FindObjectOfType(typeof(LightController)); src.Play(); lc.holy = true; StartCoroutine("FinishReading"); }
// Update is called once per frame void Update() { if (!audioSource.isPlaying) { if (gc.playerActive && !flags [1]) { audioSource.clip = freeFall; audioSource.Play(); flags [1] = true; } else if (gc.parachuteActive && !flags [2]) { audioSource.clip = parachuteOpen; audioSource.Play(); flags [2] = true; } } }
// Use this for initialization void Start() { flags = new bool[3]; gc = (GameController)FindObjectOfType(typeof(GameController)); audioSource = GetComponent <CardboardAudioSource> (); audioSource.clip = introduction; audioSource.Play(); flags [0] = true; }
// Use this for initialization void Start() { flags = new bool[3]; gc = (GameController) FindObjectOfType(typeof(GameController)); audioSource = GetComponent<CardboardAudioSource> (); audioSource.clip = introduction; audioSource.Play (); flags [0] = true; }
// Use this for initialization void Start () { CAS = GetComponent<CardboardAudioSource>(); Player = Camera.main.gameObject; CAS.Stop(); CAS.clip = IntroClips[m_curClipIndex]; CAS.Play(); }
public void SetPosition(Position position) { if (position != null) { transform.localPosition = position.AsGridLocalPosition(Marker.Target); audioSource.Play(); animator.SetTrigger("LockOnTarget"); } GetComponent <Animator> ().enabled = true; }
// Update is called once per frame void Update() { if (playerActive) { if (!wind.isPlaying) { wind.Play(); } wind.volume = playerVelocity > 100 ? 1 : playerVelocity / 100; } }
// 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(); } }
void OnTriggerEnter(Collider col) { if ((DateTime.Now - lastStepTime).TotalSeconds < PLAY_INTERVAL_MIN_SEC) { // タップダンス的な足音連打事故を防ぐ return; } FootStepSounds.StepInfo info = footStepSounds.stepInfos.Find((i) => i.groundTag == col.gameObject.tag); if (info.HasValue()) { aSource.clip = info.GetClipRandomely(); aSource.Play(); lastStepTime = DateTime.Now; } }