Ejemplo n.º 1
0
    void CreateObject(int value)
    {
        if (value == 0)
        {
            return;
        }

        SceneNode parentObject = mc.GetSelectedObject();
        Transform parent;

        if (parentObject == null)
        {
            parent = theWorld;
        }
        else
        {
            parent = parentObject.transform;
        }

        GameObject newObject = Instantiate(objects[value - 1], parent);
        SceneNode  newScene  = newObject.GetComponent <SceneNode>();
        bool       success   = ht.Insert(ref newScene, mc.GetSelectedObject());

        if (success == false)
        {
            warning.text = "Insert unsuccessful, please select parent object before attempting to insert.";
            Destroy(newObject);
        }
        else
        {
            warning.text = "";
        }

        GetComponent <Dropdown>().value = 0;
    }