コード例 #1
0
    private void Dd_onParticleDurationIsOver(object sender, EventArgs e)
    {
        DroppingDirt dd = (DroppingDirt)sender;

        dd.Hide();

        droppingDirtList.Remove(dd);
        droppingDirtPool.Add(dd);

        //onDroppingDirtIsOver(sender, e);
    }
コード例 #2
0
    public DroppingDirt GetDroppingDirt()
    {
        if (droppingDirtPool.Count <= 0)
        {
            throw new Exception();
        }

        DroppingDirt dd = droppingDirtPool[0];

        droppingDirtPool.RemoveAt(0);

        droppingDirtList.Add(dd);

        return(dd);
    }
コード例 #3
0
    private void InitDroppingDirtList()
    {
        droppingDirtList = new List <DroppingDirt>();
        droppingDirtPool = new List <DroppingDirt>();

        GameObject dirtPrefab = Resources.Load("DroppingDirt") as GameObject;

        for (int i = 0; i < 50; i++)
        {
            DroppingDirt dd = ((GameObject)Instantiate(dirtPrefab)).GetComponent <DroppingDirt>();

            dd.Init(i);
            dd.onParticleDurationIsOver += Dd_onParticleDurationIsOver;
            dd.transform.SetParent(this.transform);
            droppingDirtPool.Add(dd);
        }
    }