public PriorityList <SmartEntity> GetBuildingsToAttack(int x, int z) { Board <Entity> board = Service.Get <BoardController>().Board; board.MakeCoordinatesAbsolute(ref x, ref z); if (this.IsPositionInvalid(x, z)) { return(null); } SpatialIndex spatialIndex = this.EnsureSpatialIndex(x, z); if (!spatialIndex.AlreadyScannedBuildingsToAttack) { this.SetBuildingsToAttack(x, z, spatialIndex); } return(spatialIndex.GetBuildingsToAttack()); }