예제 #1
0
    public MineralIndicator GetIndicator()
    {
        if (indicatorPool.Count <= 0)
        {
            throw new Exception();
        }

        MineralIndicator mi = indicatorPool[0];

        indicatorPool.RemoveAt(0);

        indicatorList.Add(mi);

        return(mi);
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
 public void ShowIndicator(MineralIndicator _mi, Vector3 _randPos)
 {
     _mi.Show(_randPos);
 }