コード例 #1
0
ファイル: Dungeon.cs プロジェクト: coharou/TBQuestGame
        private Tiles[,] ClearSurroundingImpassableTiles(int x, int y, Tiles[,] tiles, TileConstants C, Tiles desired)
        {
            int right = x + 1;

            if (x == (C.TilesPerRow - 1))
            {
                right = C.TilesPerRow - 1;
            }

            int left = x - 1;

            if (x == 0)
            {
                left = 0;
            }

            int above = y - 1;

            if (y == 0)
            {
                above = 0;
            }

            int below = y + 1;

            if (y == (C.TilesPerRow - 1))
            {
                below = C.TilesPerRow - 1;
            }

            if (tiles[right, y].Passable == false)
            {
                tiles[right, y] = desired;
            }
            else if (tiles[left, y].Passable == false)
            {
                tiles[left, y] = desired;
            }
            else if (tiles[x, below].Passable == false)
            {
                tiles[x, below] = desired;
            }
            else if (tiles[x, above].Passable == false)
            {
                tiles[x, above] = desired;
            }

            return(tiles);
        }
コード例 #2
0
ファイル: Dungeon.cs プロジェクト: coharou/TBQuestGame
        private Tiles[,] ReplaceSurroundingTiles(int x, int y, Tiles[,] tiles, Tiles tile, Tiles sampler, TileConstants c, Random randObj, int chance)
        {
            Tiles plains = MatchTile(5);

            int right = x + 1;

            if (x == (c.TilesPerRow - 1))
            {
                right = c.TilesPerRow - 1;
            }

            int left = x - 1;

            if (x == 0)
            {
                left = 0;
            }

            int above = y - 1;

            if (y == 0)
            {
                above = 0;
            }

            int below = y + 1;

            if (y == (c.TilesPerRow - 1))
            {
                below = c.TilesPerRow - 1;
            }

            int value = randObj.Next(0, 100);

            if (tiles[right, y].Name == plains.Name)
            {
                if (value < chance)
                {
                    tiles[right, y] = sampler;
                }
            }
            else if (tiles[left, y].Name == plains.Name)
            {
                if (value < chance)
                {
                    tiles[left, y] = sampler;
                }
            }
            else if (tiles[x, below].Name == plains.Name)
            {
                if (value < chance)
                {
                    tiles[x, below] = sampler;
                }
            }
            else if (tiles[x, above].Name == plains.Name)
            {
                if (value < chance)
                {
                    tiles[x, above] = sampler;
                }
            }

            return(tiles);
        }
コード例 #3
0
ファイル: Dungeon.cs プロジェクト: coharou/TBQuestGame
        private Tiles GenerateBetweenTwoTileTypes(TileConstants C, Random randObj, Tiles desired, Tiles alternate, int chance)
        {
            Tiles tile = MatchTile(5);

            int value = randObj.Next(0, 100);

            if (value <= chance)
            {
                tile = desired;
            }
            else
            {
                tile = alternate;
            }

            return(tile);
        }