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(); }
private void ValidatePipPool(int count) { if (Pips.Length < count) { RadarPip[] newPips = new RadarPip[Pips.Length * 2]; for (int i = 0; i < Pips.Length; i++) { newPips[i] = Pips[i]; } for (int i = Pips.Length; i < newPips.Length; i++) { newPips[i] = new RadarPip(this); } Pips = newPips; ValidatePipPool(count); } }