// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { Move(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { Move(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.Q)) { Look(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E)) { Look(currentDirection.GetNextClockwise()); } }
void CreatePassageInSameRoom(MazeCell _cell, MazeCell _otherCell, mazeDirection _direction) { MazePassage mazePassage = Instantiate(mazePassPrefab); mazePassage.Initialise(_cell, _otherCell, _direction); mazePassage = Instantiate(mazePassPrefab); mazePassage.Initialise(_otherCell, _cell, _direction.GetOpposite()); }
private void CreateWall(mazeCell cell, mazeCell otherCell, mazeDirection direction) { mazeWall wall = Instantiate(wallPrefabs[Random.Range(0, wallPrefabs.Length)]) as mazeWall; wall.Initialize(cell, otherCell, direction); if (otherCell != null) { wall = Instantiate(wallPrefabs[Random.Range(0, wallPrefabs.Length)]) as mazeWall; wall.Initialize(otherCell, cell, direction.GetOpposite()); } }
void CreateWall(MazeCell _cell, MazeCell _otherCell, mazeDirection _direction) { MazeWall mazeWall = Instantiate(mazeWallPrefabs[Random.Range(0, mazeWallPrefabs.Length)]) as MazeWall; mazeWall.Initialise(_cell, _otherCell, _direction); if (_otherCell != null) { mazeWall = Instantiate(mazeWallPrefabs[Random.Range(0, mazeWallPrefabs.Length)]) as MazeWall; mazeWall.Initialise(_otherCell, _cell, _direction.GetOpposite()); } }
private void CreatePassageInSameRoom(mazeCell cell, mazeCell otherCell, mazeDirection direction) { mazePassage passage = Instantiate(passagePrefab) as mazePassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(passagePrefab) as mazePassage; passage.Initialize(otherCell, cell, direction.GetOpposite()); if (cell.room != otherCell.room) { mazeRoom roomToAssimilate = otherCell.room; cell.room.Assimilate(roomToAssimilate); rooms.Remove(roomToAssimilate); Destroy(roomToAssimilate); } }
private void CreatePassage(mazeCell cell, mazeCell otherCell, mazeDirection direction) { mazePassage prefab = Random.value < doorProbability ? doorPrefab : passagePrefab; mazePassage passage = Instantiate(prefab) as mazePassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(prefab) as mazePassage; if (passage is mazeDoor) { otherCell.Initialize(CreateRoom(cell.room.settingsIndex)); } else { otherCell.Initialize(cell.room); } passage.Initialize(otherCell, cell, direction.GetOpposite()); }
void CreatePassage(MazeCell _cell, MazeCell _otherCell, mazeDirection _direction) { MazePassage prefabPass = Random.value < doorProbability ? mazeDoorPrefab : mazePassPrefab; MazePassage mazePassage = Instantiate(prefabPass) as MazePassage; mazePassage.Initialise(_cell, _otherCell, _direction); if (mazePassage is MazeDoor) { //Create a new room, excluding the last index _otherCell.SetRoom((CreateRoom(_cell.room.settingIndex))); } else { //initialize with the ongoing room _otherCell.SetRoom(_cell.room); } mazePassage = Instantiate(prefabPass) as MazePassage; mazePassage.Initialise(_otherCell, _cell, _direction.GetOpposite()); }