コード例 #1
0
        public static Dictionary <Vector2Int, float> BuildMountain(int x, int y, int levelsCount, int ringWidth, float ringHeight, int maxX, int maxZ)
        {
            var result = new Dictionary <Vector2Int, float>();

            var ringsToBeRaised = MapPiecesSelector.GetRingsAround(x, y, levelsCount, ringWidth, maxX, maxZ);

            for (int i = 0; i < levelsCount; ++i)
            {
                foreach (var tile in ringsToBeRaised[i])
                {
                    if (MapOperationValidator.IsValidPointOnMap(tile.x, tile.y, maxX, maxZ))
                    {
                        if (!result.ContainsKey(tile))
                        {
                            result.Add(tile, (levelsCount - i) * ringHeight);
                        }
                        else
                        {
                            result[tile] = (levelsCount - i) * ringHeight;
                        }
                    }
                }
            }
            return(result);
        }
コード例 #2
0
        public void ColorRingsAround(int x, int y, int ringsCount, int ringWidth)
        {
            var rings = MapPiecesSelector.GetRingsAround(x, y, ringsCount, ringWidth, XResolution, ZResolution);

            foreach (var ring in rings)
            {
                foreach (var tile in ring.Value)
                {
                    ColorTileExact(tile.x, tile.y, _colors[ring.Key]);
                }
            }
        }
コード例 #3
0
        public HashSet <Vector2Int> GetCircle(int x, int y, int radius)
        {
            var circle = MapPiecesSelector.GetRingsAround(x, y, 0, radius, XResolution, ZResolution);

            return(new HashSet <Vector2Int>(circle[0]));
        }