Example #1
0
    public GameObject GetUnusedObject <T>()
    {
        if (typeof(T) == typeof(Vehicle))
        {
            return(VehiclePool.GetUnusedObject());
        }

        else if (typeof(T) == typeof(Tile.GroundTile))
        {
            return(GroundTilePool.GetUnusedObject());
        }
        else if (typeof(T) == typeof(Tile.EndpointTile))
        {
            return(EndpointTilePool.GetUnusedObject());
        }

        else if (typeof(T) == typeof(Consumer))
        {
            return(ConsumerPool.GetUnusedObject());
        }
        else if (typeof(T) == typeof(Producer))
        {
            return(ProducerPool.GetUnusedObject());
        }

        return(null);
    }