void SpawnAliens(int count) { for (int i = 0; i < count; i++) { var rotation = Random.Range(0.03f, 0.1f); Vector3 sec_pos = Vector3.RotateTowards(GameValues.ShipPos, new Vector3(0,0,5) * GameValues.ShipPos.magnitude, rotation, GameValues.ShipPos.magnitude); float angle = i * 360.0f/count; var detail_pos = Quaternion.AngleAxis(angle, GameValues.ShipPos) * sec_pos; Alien a = new Alien (health: 100, speed: 2f, range: 7); a.GameObject = Creator.Create ("Alien_withDying", detail_pos, "Alien"); gs.aliens.Add (a.GameObject, a); gs.creatures.Add(a.GameObject, a as Creature); a.GameObject.transform.up = -(transform.position - GameValues.ShipPos).normalized; a.Search(); } // Tell UI that aliens have been spawned ui.SetAlienSlider(); ui.SetResourceSlider(); }