public void Init(bool started) { active = new List <GameObject>(); GameObject go; go = Instantiate(zombie) as GameObject; go.transform.position = new Vector3(7.63f, 0, -10.55f); go.transform.SetParent(transform); go.transform.tag = "Zombie"; active.Add(go); paused = false; gs = GameObject.FindGameObjectWithTag("Canvas").GetComponent <GameStart>(); control = GameObject.FindGameObjectWithTag("Zombie").GetComponent <CharacterController>(); mobsource.Play(); mobsource.volume = 0.05f; pause.onClick.AddListener(TaskOnClickPause); //GameOverImage = GameObject.Find("GameOverImage").GetComponent<GameObject>(); score = 0; heartcount = 3; dead = false; runspeed = fixedrunspeed; totalspeed = fixedrunspeed; canvas = GameObject.FindGameObjectWithTag("Canvas").transform; activeHearts = new List <GameObject>(); for (int i = 0; i < 3; i++) { go = Instantiate(hearts[i]) as GameObject; go.transform.position = new Vector3(153 + (i * 90), -57, 0); go.transform.SetParent(canvas, false); activeHearts.Add(go); } cc = GameObject.FindGameObjectWithTag("Zombie").GetComponent <CollisionControl>(); cc.Init(true); begin = true; }
public void DeletePlayer() { cc.Init(false); Destroy(active[0]); active.RemoveAt(0); Destroy(activeHearts[0]); Destroy(activeHearts[1]); Destroy(activeHearts[2]); activeHearts.Clear(); }