Esempio n. 1
0
    private void MovePlayerToRandomTile(BasicRandom r)
    {
        var randomTile = tiles[0, 0];
        int x = 0, y = 0;

        while (randomTile != TileType.Floor)
        {
            x          = r.Next(0, tiles.GetLength(0));
            y          = r.Next(0, tiles.GetLength(1));
            randomTile = tiles[x, y];
        }

        player.transform.position = new Vector3(x, 1, y);
    }
Esempio n. 2
0
    private void MovePlayerToRandomTile(BasicRandom r, TileType[,] dungeon)
    {
        var randomTile = dungeon[0, 0];
        int x = 0, y = 0;

        while (randomTile != TileType.Floor)
        {
            x          = r.Next(0, dungeon.GetLength(0));
            y          = r.Next(0, dungeon.GetLength(1));
            randomTile = dungeon[x, y];
        }

        MovePlayerToTile(x, y);
    }