public void Spawn1() { GameObject spawn = Instantiate(musuh, spwn1.transform.position, Quaternion.identity) as GameObject; musuh x = spawn.GetComponent <musuh>(); x.SetHealth(); }
IEnumerator SpawnCycle1() { if (!gamemanager.paused) { if (gamemanager.newgame == true) { yield return(new WaitForSeconds(Random.Range(1f, 2f))); gamemanager.newgame = false; } GameObject spawn = Instantiate(musuh, child1.transform.position, Quaternion.identity) as GameObject; musuh x = spawn.GetComponent <musuh>(); x.SetHealth(); if (gamemanager.score % 150 == 0) { //kalau skor udh sampai 50, interval berkurang if (interval1 <= 0.7f) { interval1 = 0.7f; } else { interval1 -= 0.15f; } } } yield return(new WaitForSeconds(interval1 + Random.Range(0f, 0.5f))); StartCoroutine(SpawnCycle1()); }
public IEnumerator Spawn4() { yield return(new WaitForSeconds(Random.Range(0f, 1f))); GameObject spawn = Instantiate(musuh, spwn4.transform.position, Quaternion.identity) as GameObject; musuh x = spawn.GetComponent <musuh>(); x.SetHealth(); }