Ejemplo n.º 1
0
        public void resetPlayerPosition(string playerDirection)
        {
            switch (playerDirection)
            {
            case "north":
                _player.position.Y = (_activeRoom.GetLength(1) - 2) * _scaledTile;
                break;

            case "south":
                _player.position.Y = 100;
                break;

            case "east":
                _player.position.X = 100;
                break;

            case "west":
                _player.position.X = ((_activeRoom.GetLength(0) - 2)) * _scaledTile;
                break;
            }
            _pathFinding = new PathFinding(_activeRoom);
            var collision = new Collision(_activeRoom);

            _collision = collision;
            ChangeRooms(_roomIndex[0], _roomIndex[1]);
        }
Ejemplo n.º 2
0
        private void RoomToDungeon()
        {
            for (var i = 0; i < 5; i++)
            {
                for (var j = 0; j < 5; j++)
                {
                    if (_dungeonArray[i, j] == "_")
                    {
                        var doors     = DoorGenCheck(i, j);
                        var tileArray = _room.GenerateRoom(20, 20, doors);
                        var roomInfo  = new RoomInfo("_", tileArray, _rnd);
                        _enemyArray[i, j] = roomInfo.GenerateEnemies();
                        _worldArray[i, j] = tileArray;
                    }
                    else if (_dungeonArray[i, j] == "S")
                    {
                        var enemyArray = new String[2, 2];
                        var spawnEnemy = new SpawnEnemy(enemyArray, _content);

                        _activeEnemies = spawnEnemy.Spawn();

                        var doors     = DoorGenCheck(i, j);
                        var tileArray = _room.GenerateRoom(20, 20, doors);
                        var roomInfo  = new RoomInfo("_", tileArray, _rnd);
                        _worldArray[i, j] = tileArray;
                        _activeRoom       = _worldArray[i, j];
                        var indX = i;
                        var indY = j;
                        _roomIndex[0] = indX;
                        _roomIndex[1] = indY;
                        _pathFinding  = new PathFinding(_activeRoom);
                    }
                }
            }
        }