public RadarPip(RadarGUIController radarController) { RadarController = radarController; Pip = GameObject.Instantiate(GeneralPrefabs.Instance.RadarPip, Vector2.zero, Quaternion.identity); Pip.transform.SetParent(RadarController.ContentsTransform.transform); Pip.SetActive(false); Arrow = GameObject.Instantiate(GeneralPrefabs.Instance.RadarArrow, Vector2.zero, Quaternion.identity); Arrow.transform.SetParent(RadarController.ContentsTransform.transform); Arrow.SetActive(false); }
private void Awake() { Instance = this; Pips = new RadarPip[10]; for (int i = 0; i < Pips.Length; i++) { Pips[i] = new RadarPip(this); } // Calculate the radius in pixels of the radar display. We multiply // the image width by 0.9f because that happens to be the size of the // radar screen in the image we're using. And we divide by 2f because // we want the radius, not the diameter. PixelRadius = GetComponent <RectTransform>().rect.width * 0.9f / 2f; UpdateScaleText(); }