public ActorMap(World world, ActorMapInfo info) { this.info = info; map = world.Map; influence = new[] { new CellLayer <InfluenceNode>(world.Map) }; cols = CellCoordToBinIndex(world.Map.MapSize.X) + 1; rows = CellCoordToBinIndex(world.Map.MapSize.Y) + 1; bins = new Bin[rows * cols]; for (var row = 0; row < rows; row++) { for (var col = 0; col < cols; col++) { bins[row * cols + col] = new Bin(); } } // PERF: Cache this delegate so it does not have to be allocated repeatedly. actorShouldBeRemoved = removeActorPosition.Contains; LargestActorRadius = map.Rules.Actors.SelectMany(a => a.Value.TraitInfos <HitShapeInfo>()).Max(h => h.Type.OuterRadius); var blockers = map.Rules.Actors.Where(a => a.Value.HasTraitInfo <IBlocksProjectilesInfo>()); LargestBlockingActorRadius = blockers.Any() ? blockers.SelectMany(a => a.Value.TraitInfos <HitShapeInfo>()).Max(h => h.Type.OuterRadius) : WDist.Zero; }
public ActorMap(World world, ActorMapInfo info) { this.info = info; map = world.Map; influence = new CellLayer <InfluenceNode>(world.Map); cols = CellCoordToBinIndex(world.Map.MapSize.X) + 1; rows = CellCoordToBinIndex(world.Map.MapSize.Y) + 1; bins = new Bin[rows * cols]; for (var row = 0; row < rows; row++) { for (var col = 0; col < cols; col++) { bins[row * cols + col] = new Bin(); } } // PERF: Cache this delegate so it does not have to be allocated repeatedly. actorShouldBeRemoved = removeActorPosition.Contains; }