void Start() { freezeMaster = Object.FindObjectOfType <FreezeMaster>(); spawns = Object.FindObjectsOfType <SpawnLocation>().ToList(); items = Object.FindObjectsOfType <Item>().ToList(); //get existing actors, top up as necessary - assume built are goodies goodies = Object.FindObjectsOfType <Actor>().ToList(); //populateActors(goodies, numGoodies, -10, 2, "Goody"); //populateActors(baddies, numBadies, 25, 4, "Baddy"); populateActors(goodies, numGoodies, "Goody"); populateActors(baddies, numBadies, "Baddy"); //now deactivate baddies until just have our target number activeBaddies = 0; foreach (Actor a in baddies) { if (activeBaddies >= targetActiveBaddies) { a.gameObject.SetActive(false); } else { activeBaddies++; } } }
private void OnEnable() { if (master == null) { master = Object.FindObjectOfType <FreezeMaster>(); } master.RegisterMe(this); }
private void Start() { freezeMaster = Object.FindObjectOfType <FreezeMaster>(); soldiers = Object.FindObjectsOfType <Actor>().ToList(); foreach (Actor s in soldiers) { s.SetupInput(this); } horizon = new VectorLine("Line: Horizon", new List <Vector2>(), 1); horizon.points2.Add(new Vector2(0, Screen.height / 2f)); horizon.points2.Add(new Vector2(Screen.width, Screen.height / 2f)); horizon.color = Color.green; horizon.Draw(); }