/// <summary>
        /// Selects region, highlights it. If incorrect region is selected, all previously selected regions are resetted.
        /// </summary>
        /// <param name="y"></param>
        /// <param name="playerPerspective"></param>
        /// <param name="army">Army size of the (x,y) specified region.</param>
        /// <param name="x"></param>
        /// <returns>How many regions are selected at the moment.</returns>
        public int SelectRegion(int x, int y, Player playerPerspective, int army)
        {
            var region = templateProcessor.GetRegion(x, y);

            // is it fog of war game?
            if (isFogOfWar)
            {
                // owner is player and its my or neighbour region
                if (region.Owner != null && (region.Owner == playerPerspective || region.IsNeighbourOf(playerPerspective)))
                {
                    highlightRegionHandler.HighlightRegion(region, Color.FromKnownColor(region.Owner.Color), army);
                }
                // owner is nobody and its an neighbour
                else if (region.Owner == null && region.IsNeighbourOf(playerPerspective))
                {
                    highlightRegionHandler.HighlightRegion(region, Global.RegionVisibleUnoccupiedColor, army);
                }
                // its not an neighbour
                else
                {
                    highlightRegionHandler.HighlightRegion(region, Global.RegionNotVisibleColor, army);
                }
            }
            else
            {
                if (region.Owner != null)
                {
                    highlightRegionHandler.HighlightRegion(region, Color.FromKnownColor(region.Owner.Color), army);
                }
                else
                {
                    highlightRegionHandler.HighlightRegion(region, Global.RegionVisibleUnoccupiedColor, army);
                }
            }

            selectedRegions.Add(region);

            return(highlightRegionHandler.HighlightedRegionsCount);
        }
Пример #2
0
 internal Region GetRegion(int x, int y)
 {
     return(templateProcessor.GetRegion(x, y));
 }