예제 #1
0
    public override bool IsAvailable()
    {
        int count = 0;

        for (int i = 0; i < transform.childCount; i++)
        {
            Mushroom_GOAT m = transform.GetChild(i).GetComponent <Mushroom_GOAT>();
            if (m.IsAvailable())
            {
                count++;
            }
        }

        return(count >= 3);
    }
예제 #2
0
    public void Gather()
    {
        int count = 3;

        for (int i = transform.childCount - 1; i >= 0; i--)
        {
            Mushroom_GOAT m = transform.GetChild(i).GetComponent <Mushroom_GOAT>();
            if (m.IsAvailable())
            {
                m.Gather();
                if (count == 0)
                {
                    break;
                }
            }
        }
    }