public void Awake() { NetworkingController.NewSession((_) => {}); PersistentDataController = Object.FindObjectOfType <PersistentDataController>(); if (PersistentDataController == null) { PersistentDataController = Instantiate(PersistentDataControllerPrefab).GetComponent <PersistentDataController>(); } GameOverController.GetComponentInChildren <NewHighscoreController>().PersistentDataController = PersistentDataController; YouWonController.gameObject.GetComponentInChildren <NewHighscoreController>().PersistentDataController = PersistentDataController; Volume.sharedProfile.TryGet <ColorAdjustments>(out ColorAdjustments); List <Sprite> Pilots = PilotImages.ToList(); List <Vector2> points = new List <Vector2>(); for (int i = 0; i < MaxPilots; i++) { bool badPosition = true; Vector2 position = Vector2.zero; while (badPosition) { badPosition = false; position = Random.insideUnitCircle.normalized; foreach (var point in points) { if (Vector2.Distance(point, position) < 0.5f) { badPosition = true; break; } } } points.Add(position); GameObject pilot = Instantiate(Pilot, position * Random.Range(75f, 175f), transform.rotation, transform.parent); GameObject arrow = Instantiate(Arrow, Vector2.zero, transform.rotation, transform.parent); ArrowController arrowController = arrow.GetComponent <ArrowController>(); arrowController.Target = pilot; int index = Random.Range(0, Pilots.Count); arrowController.SetCentralImage(Pilots[index]); Pilots.RemoveAt(index); PilotController pilotController = pilot.GetComponent <PilotController>(); pilotController.WorldController = this; pilotController.ArrowController = arrowController; if (i != 0) { arrow.SetActive(false); InactiveObjectsToActivateOnFirstPilot.Add(arrow); pilot.SetActive(false); InactiveObjectsToActivateOnFirstPilot.Add(pilot); } else { pilot.GetComponentInChildren <CameraController>().ForceCamera(0.01f, IntroTime, 9f); GameUIController.BlinkText(4, () => { Camera.main.GetComponent <CinemachineBrain>().m_UpdateMethod = CinemachineBrain.UpdateMethod.FixedUpdate; Camera.main.GetComponent <CinemachineBrain>().m_BlendUpdateMethod = CinemachineBrain.BrainUpdateMethod.FixedUpdate; }); // The ship should look at the first pilot Vector3 relativePos = (pilot.transform.position - ShipController.transform.position).normalized; float z = Mathf.Atan2(relativePos.y, relativePos.x) * Mathf.Rad2Deg; ShipController.transform.rotation = Quaternion.Euler(ShipController.transform.rotation.x, ShipController.transform.rotation.y, z); arrowController.Blink(2); } } SpaceStation.SetActive(false); ArrowController spaceStationArrowController = SpaceStationArrow.GetComponent <ArrowController>(); spaceStationArrowController.Target = SpaceStation; spaceStationArrowController.SetCentralImage(SpaceStationArrowSprite); SpaceStationArrow.SetActive(false); }