예제 #1
0
    private void Refresh()
    {
        FoodObject food = PlayerData.player.GetCounterFood(counterNum);

        for (int i = gameObject.transform.childCount - 1; i >= 0; --i)
        {
            Destroy(gameObject.transform.GetChild(i).gameObject);
        }

        if (food != null)
        {
            Instantiate(Resources.Load(food.getModel()), gameObject.transform);
            gameObject.transform.GetChild(0).localPosition += new Vector3(0f, -0.21f, 0f);
            // gameObject.transform.GetChild(0).rotation = Quaternion.identity;
            if (food.getPlate())
            {
                Instantiate(Resources.Load("Models/plate"), gameObject.transform);
                gameObject.transform.GetChild(1).localPosition += new Vector3(0f, -0.21f, 0f);
                // gameObject.transform.GetChild(1).rotation = Quaternion.identity;
                // move food slightly up
                gameObject.transform.GetChild(0).localPosition += new Vector3(0f, 0.03f, 0f);
            }
        }
    }