dronkowitz

Emblem.cs

Feb 22nd, 2021 (edited)
1,061
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Emblem : MonoBehaviour
  6. {
  7.     public AudioClip clip;
  8.     GameObject source;
  9.     public bool levelrunning = false;
  10.     public static float timeelapsed = 0;
  11.  
  12.     // Start is called before the first frame update
  13.     void Start()
  14.     {
  15.         StartCoroutine(LevelTimer());
  16.         source = Resources.Load<GameObject>("Audio Object");
  17.        
  18.  
  19.     }
  20.  
  21.     // Update is called once per frame
  22.     void Update()
  23.     {
  24.        
  25.     }
  26.  
  27.     private void OnTriggerEnter(Collider other)
  28.     {
  29.         Debug.Log("End Level");
  30.         GameObject ao = Instantiate(source, transform.position, Quaternion.identity);
  31.         ao.GetComponent<AudioObject>().Setup(clip, transform);
  32.     }
  33.  
  34.     public IEnumerator LevelTimer()
  35.     {
  36.         while (levelrunning == true)
  37.         {
  38.  
  39.             timeelapsed += Time.deltaTime;
  40.             yield return new WaitForEndOfFrame();
  41.         }
  42.  
  43.  
  44.  
  45.     }
  46.  
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment