Пример #1
0
    void GenerateBaseHexes()
    {
        int layerCount = iStats.layerStats.Count;

        for (int layerIndex = 0; layerIndex < layerCount; layerIndex++)
        {
            Vector2 point = HexHelp.GetCenter(rings);
            tiles[layerIndex, (int)point.y, (int)point.x] = HexType.Earth;
            for (int ring = 1; ring < rings; ring++)
            {
                point = HexHelp.MoveInDirection(point, HexDir.Up);
                for (int direction = 0; direction < 6; direction++)
                {
                    for (int distance = 0; distance < ring; distance++)
                    {
                        bool inThreshold = iStats.layerStats[layerIndex].GetAt((int)point.x, (int)point.y) > iStats.layerStats[layerIndex].threshold;
                        bool hasBelow    = HexHelp.CheckBelow((int)point.x, (int)point.y, layerIndex, tiles);
                        if ((layerIndex == 0 || hasBelow) && inThreshold)
                        {
                            tiles[layerIndex, (int)point.y, (int)point.x] = HexType.Earth;
                        }
                        point = HexHelp.MoveInDirection(point, (HexDir)direction);
                    }
                }
            }
        }
    }