public BattleEventArgs(Region winner, string strDefeatString, Region loser)
        {
            Winner = winner;
            DefeatString = strDefeatString;
            Loser = loser;

            _overtakestep = loser.Tiles.Count / _overtakeframes;
        }
Exemple #2
0
        public Map(Vector2 position)
        {
            // layout
            Position = position;
            WidthInPixels = Statics.LeftColumnWidth - (int)Position.X * 2;
            HeightInPixels = Statics.CanvasHeight - Statics.LeftColumnPadding * 2 - (int)Position.Y * 2;

            UpdateDelta = TimeSpan.Zero;
            State = MAPSTATE.READY_FOR_BATTLE;

            // DEBUG
            MergeCount = 0;
            // END DEBUG

            // MapTiles holds only whether a map tile coordinate is still available
            MasterTileList = new Tile[WidthInTiles, HeightInTiles];

            for (int x = 0; x < WidthInTiles; x++)
            {
                for (int y = 0; y < HeightInTiles; y++)
                {
                    MasterTileList[x, y] = new Tile(new Point(x, y));
                }
            }

            // now we have a grid of tiles, each of which states its availability
            // loop, creating regions, each of which will switch off a series of tiles
            int AvailableTileCount = WidthInTiles * HeightInTiles;
            int nCurrentRegionId = 0;
            while (AvailableTileCount > 0)
            {
                Region region = new Region(nCurrentRegionId++, MasterTileList);
                Regions.Add(region);

                AvailableTileCount -= region.Tiles.Count;
            }

            MergeRegions(MasterTileList);
            ReindexRegions();
        }
Exemple #3
0
        private void MergeRegions(Region r1, Region r2)
        {
            foreach(Tile tile in r2.Tiles)
            {
                r1.Tiles.Add(tile);
            }

            Regions.Remove(r2);
        }