コード例 #1
0
    void Start()
    {
        bag = GetComponent <MixedBagRandom>();

        for (int i = 0; i < stockpile_count; ++i)
        {
            MixedBagRandom.Types newType = bag.GetNewType();

            stockpile.Add(newType);
        }

        // m_UIDirections.UpdateItems(GetStraightCount(), GetCurvedCount());
    }
コード例 #2
0
    public void ChangeItems(MixedBagRandom.Types remove, MixedBagRandom.Types add)
    {
        foreach (Transform t in directions.transform)
        {
            if (t.gameObject.CompareTag((remove == MixedBagRandom.Types.STRAIGHT) ? "straight" : "turn"))
            {
                Destroy(t.gameObject);
                break;
            }
        }
        //Destroy(GameObject.FindGameObjectWithTag((remove == MixedBagRandom.Types.STRAIGHT) ? "straight" : "turn"));

        Instantiate(add == MixedBagRandom.Types.STRAIGHT ? straight : turn, directions.transform);
    }
コード例 #3
0
    public bool GetTrack(MixedBagRandom.Types desired_type)
    {
        foreach (MixedBagRandom.Types type in stockpile)
        {
            if (type == desired_type)
            {
                stockpile.Remove(type);
                MixedBagRandom.Types newType = bag.GetNewType();
                stockpile.Add(newType);

                //   m_UIDirections.ChangeItems(desired_type, newType);

                return(true);
            }
        }

        return(false);
    }