示例#1
0
        private static string GetMaximumPopulationText(int terrainId, CellGrid cellGrid, HexOffsetCoordinates hexPoint)
        {
            var gameConfigCache = CallContext <GameConfigCache> .GetData("GameConfigCache");

            var terrain = gameConfigCache.GetTerrainConfigById(terrainId);

            if (!terrain.CanSettleOn)
            {
                return(string.Empty);
            }

            var catchment = cellGrid.GetCatchment(hexPoint.Col, hexPoint.Row, 2);
            var maxPop    = BaseFoodLevel.DetermineBaseFoodLevel(catchment);
            var text      = $"Maximum Pop - {maxPop}";

            return(text);
        }
示例#2
0
 public Cell GetCell(HexOffsetCoordinates location)
 {
     return(GetCell(location.Col, location.Row));
 }
示例#3
0
        private static void DrawTileInfo(SpriteBatch spriteBatch, SpriteFont font, float x, float y, CellGrid cellGrid, HexOffsetCoordinates hexPoint)
        {
            var cell = cellGrid.GetCell(hexPoint);

            if (cell.SeenState == SeenState.NeverSeen)
            {
                return;
            }

            var terrain               = GetTerrain(cell.TerrainId);
            var terrainTypeText       = $"{terrain.Name} - {terrain.FoodOutput} food";
            var maximumPopulationText = GetMaximumPopulationText(cell.TerrainId, cellGrid, hexPoint);

            spriteBatch.DrawString(font, terrainTypeText, new Vector2(x, y), Color.White);
            spriteBatch.DrawString(font, maximumPopulationText, new Vector2(x, y + 15.0f), Color.White);
        }