123456789101112131415161718192021222324252627282930313233343536373839 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Caraudio : MonoBehaviour
- {
- // Start is called before the first frame update
- public float timelenth;
- public float timelenth2;
- public AudioClip []Music;
- void Start()
- {
-
- }
- public void OnEnable()
- {
- StartCoroutine(playmusic());
- StartCoroutine(playmusichoner());
- //Invoke("playmusic", timelenth);
- //Invoke("playmusichoner", timelenth2);
- }
- public IEnumerator playmusic()
- {
- yield return new WaitForSeconds(11f);
- this.gameObject.GetComponent<AudioSource>().clip=Music[0];
- this.gameObject.GetComponent<AudioSource>().Play();
- }
- public IEnumerator playmusichoner()
- {
- yield return new WaitForSeconds(28f);
- this.gameObject.GetComponent<AudioSource>().clip = Music[1];
- this.gameObject.GetComponent<AudioSource>().Play();
- }
- // Update is called once per frame
- void Update()
- {
-
- }
- }
|