예제 #1
0
    public void addItem()
    {
        //Debug.Log(itemName.text);
        //Debug.Log(Int32.Parse(quantity.text));
        if (
            (height.text) == "" ||
            (width.text) == "" ||
            (length.text) == "" ||
            (itemName.text) == "" ||
            (quantity.text) == ""
            )
        {
            Debug.Log("Failed to add item");
            StartCoroutine(failText());
            return;
        }
        Item myItem = new Item(itemName.text, Int32.Parse(height.text),
                               Int32.Parse(width.text), Int32.Parse(length.text), Int32.Parse(quantity.text));

        if (Gamemanager._instance.filledSpace - myItem.Height * myItem.Width * myItem.Length > 0)
        {
            m_instance.addItemToList(myItem);
            space.text = m_instance.filledSpace + "/" + m_instance.capacity;
        }
        else
        {
            Debug.Log("Failed to add item");
            StartCoroutine(failText());
        }
    }