public MineralIndicator GetIndicator() { if (indicatorPool.Count <= 0) { throw new Exception(); } MineralIndicator mi = indicatorPool[0]; indicatorPool.RemoveAt(0); indicatorList.Add(mi); return(mi); }
private void InitIndicator() { indicatorPool = new List <MineralIndicator>(); indicatorList = new List <MineralIndicator>(); GameObject indicatorPrefab = Resources.Load("MineralIndicator") as GameObject; GameObject indicatorParent = new GameObject("MineralIndicatorParent"); indicatorParent.transform.SetParent(this.transform); for (int i = 0; i < 30; i++) { MineralIndicator mi = ((GameObject)Instantiate(indicatorPrefab)).GetComponent <MineralIndicator>(); mi.Init(i); mi.transform.SetParent(indicatorParent.transform); indicatorPool.Add(mi); } }
public void ShowIndicator(MineralIndicator _mi, Vector3 _randPos) { _mi.Show(_randPos); }