Exemplo n.º 1
0
 public void Add(PoolableObj item)
 {
     if (!poolableList.Any(po => po.type == item.type))
     {
         poolableList.Add(item);
     }
 }
Exemplo n.º 2
0
    void AddEditButtons()
    {
        bool showAddNotEdit     = true;
        bool editButtonDisabled = false;

        //check if type already exists
        for (int i = 0; i < poolableDB.poolableList.Count; i++)
        {
            if (tileType && tileType.name == poolableDB.poolableList[i].Name)
            {
                showAddNotEdit = false;
            }
        }

        if (!prefab)
        {
            EditorGUILayout.HelpBox("Prefab must be set", MessageType.Warning);
            editButtonDisabled = true;
        }

        EditorGUI.BeginDisabledGroup(editButtonDisabled);

        if (showAddNotEdit && GUILayout.Button("Add"))
        {
            poolableDB.poolableList.Add(new PoolableObj(tileType, instNum, prefab));
        }

        if (!showAddNotEdit && GUILayout.Button("Save"))
        {
            poolableDB[tileType] = new PoolableObj(tileType, instNum, prefab);
        }

        EditorGUI.EndDisabledGroup();
    }
Exemplo n.º 3
0
 public bool Remove(PoolableObj item)
 {
     return(poolableList.Remove(item));
 }