Example #1
0
    public bool ReturnElement(IDataPool_Element element)
    {
        DataPool_ElementData data = element.DataPool_Element_GetData();

        if (element == null)
        {
            Debug.LogError("Can't return object. Reason: object is null");
            return(false);
        }
        else if (data.fOwner != this)
        {
            Debug.LogError(string.Concat("Can't return object '", element, "' to this pool ('", this, "'). Reason: The pool has no ownership this object. "));
            return(false);
        }

        fPoolUsedCount--;
        fObjectPool[data.fPoolIndex] = fObjectPool[fPoolUsedCount];
        fObjectPool[data.fPoolIndex].DataPool_Element_SetData(data);
        fObjectPool[fPoolUsedCount] = element;
        data.fPoolIndex             = -1;
        element.DataPool_Element_SetData(data);
        return(true);
    }
Example #2
0
 public void DataPool_Element_SetData(DataPool_ElementData data)
 {
     fDataPool_ElementData = data;
 }