| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | |
| | | 5 | | public class SpawnPaper : MonoBehaviour |
| | | 6 | | { |
| | | 7 | | [SerializeField] |
| | | 8 | | private AudioClip clip; |
| | | 9 | | |
| | | 10 | | [SerializeField] |
| | | 11 | | private GameObject paperToSpawn; |
| | | 12 | | |
| | | 13 | | [SerializeField] |
| | | 14 | | private GameObject position; |
| | | 15 | | |
| | | 16 | | public void spawn() |
| | 1 | 17 | | { |
| | 1 | 18 | | StartCoroutine(ExecuteAfterTime(clip.length)); |
| | 1 | 19 | | } |
| | | 20 | | |
| | | 21 | | public IEnumerator ExecuteAfterTime(float time) |
| | 1 | 22 | | { |
| | 1 | 23 | | yield return new WaitForSeconds(time); |
| | 1 | 24 | | Instantiate(paperToSpawn, position.transform.position, position.transform.rotation); |
| | 1 | 25 | | } |
| | | 26 | | } |
| | | 27 | | |