public void Dispose() { if (layerPool != null) { foreach (var layer in layers) { layerPool.ReturnLayer(layer); } } layers = null; layerPool = null; }
public PathGraph(CellInfoLayerPool layerPool, MobileInfo mobileInfo, Actor actor, World world, bool checkForBlocked) { pooledLayer = layerPool.Get(); groundInfo = pooledLayer.GetLayer(); var layers = world.GetCustomMovementLayers().Values.Where(cml => cml.EnabledForActor(actor.Info, mobileInfo)); foreach (var cml in layers) { customLayerInfo[cml.Index] = Pair.New(cml, pooledLayer.GetLayer()); } World = world; this.mobileInfo = mobileInfo; worldMovementInfo = mobileInfo.GetWorldMovementInfo(world); Actor = actor; LaneBias = 1; checkConditions = checkForBlocked ? CellConditions.TransientActors:CellConditions.None; checkTerrainHeight = world.Map.Grid.MaximumTerrainHeight > 0; }
public PooledCellInfoLayer(CellInfoLayerPool layerPool) { this.layerPool = layerPool; }