public void CheckToys() { // We just put something down, update text and // see if we won int set = 0; foreach (GameObject toy in toys) { ToyScript ts = toy.GetComponent <ToyScript>(); if (ts.set) { set += 1; } } var t = GameObject.Find("ToyText").GetComponent <Text>(); t.text = set + " / " + toys.Count; if (set == toys.Count) { t.color = Color.green; var ps = GameObject.Find("Player").GetComponent <PlayerScript>(); ps.DisplayHint("Quickly! My ray gun! In the blue room!"); var locked = GameObject.Find("LockedWeapon"); var pos = locked.transform.position; Destroy(locked); Instantiate(weaponPrefab, pos, Quaternion.identity); } }
public void ForceWin() { // For debugging, put all toys away foreach (GameObject toy in toys) { ToyScript ts = toy.GetComponent <ToyScript>(); ts.transform.position = ts.hole.transform.position; } }