Пример #1
0
 public void Initialize(ResponseGameInfo info, IIntelManager intelManager)
 {
     PlacementGrid = new ImageDataHandler(info.StartRaw.PlacementGrid);
     NonPathable   = new ImageDataHandler(info.StartRaw.PathingGrid);
     TerrainHeight = new ImageDataHandler(info.StartRaw.TerrainHeight);
     BlockedGrid   = new ImageDataHandler(PlacementGrid.Width, PlacementGrid.Height, new byte[PlacementGrid.Width * PlacementGrid.Height]);
     NaturalGrid   = new ImageDataHandler(PlacementGrid.Width, PlacementGrid.Height, new byte[PlacementGrid.Width * PlacementGrid.Height]);
     Power         = new ImageDataHandler(PlacementGrid.Width, PlacementGrid.Height, new byte[PlacementGrid.Width * PlacementGrid.Height]);
     Creep         = new ImageDataHandler(PlacementGrid.Width, PlacementGrid.Height, new byte[PlacementGrid.Width * PlacementGrid.Height]);
     Explored      = new ImageDataHandler(PlacementGrid.Width, PlacementGrid.Height, new byte[PlacementGrid.Width * PlacementGrid.Height]);
     intelManager.Handler.RegisterHandler(Case.StructureAddedSelf, u => EventUnitAdded(u));
     intelManager.Handler.RegisterHandler(Case.StructureDestroyed, u => EventUnitDestroyed(u));
 }
Пример #2
0
        private List <Tile> GetNeighbors(Tile tile, List <Tile> tiles, ImageDataHandler nonPathable)
        {
            var neighbors = new List <Tile>();

            neighbors.Add(tiles.Find(t => t.X == tile.X - 1 && t.Y == tile.Y - 1));
            neighbors.Add(tiles.Find(t => t.X == tile.X - 1 && t.Y == tile.Y));
            neighbors.Add(tiles.Find(t => t.X == tile.X - 1 && t.Y == tile.Y + 1));
            neighbors.Add(tiles.Find(t => t.X == tile.X && t.Y == tile.Y - 1));
            neighbors.Add(tiles.Find(t => t.X == tile.X && t.Y == tile.Y + 1));
            neighbors.Add(tiles.Find(t => t.X == tile.X + 1 && t.Y == tile.Y - 1));
            neighbors.Add(tiles.Find(t => t.X == tile.X + 1 && t.Y == tile.Y));
            neighbors.Add(tiles.Find(t => t.X == tile.X + 1 && t.Y == tile.Y + 1));

            neighbors.RemoveAll(i => i == null);
            return(neighbors);
        }
Пример #3
0
        private void UpdateImageGrid(float radius, float xPosition, float yPosition, byte value, ImageDataHandler image)
        {
            var x    = (int)(xPosition - radius);
            var y    = (int)(yPosition - radius);
            var size = radius * 2;

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    image.Set(x + i, y + j, value);
                }
            }
        }