-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclownSpawnerScript.cs
More file actions
39 lines (28 loc) · 873 Bytes
/
Copy pathclownSpawnerScript.cs
File metadata and controls
39 lines (28 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using UnityEngine;
using System.Collections;
public class clownSpawnerScript : MonoBehaviour {
public Transform prefab;
public Transform prefabClone;
public GameObject startingRoom;
public float spawnSpeed;
// Use this for initialization
void Start () {
//spawnSpeed = GameObject.FindGameObjectWithTag("GameLogic").GetComponent<gameLogic>().spawnSpeed;
InvokeRepeating("spawnClown", 1,spawnSpeed);
if (startingRoom == null)
Debug.LogError("SET UP A ROOM IDIOT!");
}
// Update is called once per frame
void Update () {
//StartCoroutine(waitSeconds(1f));
}
void spawnClown()
{
prefabClone = (Transform)Instantiate (prefab, transform.position, Quaternion.identity);
prefabClone.GetComponent<baseClownScript>().currentRoom = startingRoom;
}
IEnumerator waitSeconds (float seconds)
{
yield return new WaitForSeconds(seconds);
}
}