void Update() { if (Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.UpArrow)) // NOTE Should use axes keys { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { Move(currentDirection.GetOposite()); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.Q) || Input.GetKeyDown(KeyCode.LeftArrow)) { Move(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.A)) { Rotate(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E)) { Rotate(currentDirection.GetNextClockwise()); } }
void CreateWall(MazeCell thisCell, MazeCell thatCell, MazeDirection direction) { MazeWall wall = Instantiate(wallPrefabs[Random.Range(0, wallPrefabs.Length)]) as MazeWall; wall.Initialize(thisCell, thatCell, direction); if (thatCell != null) { wall = Instantiate(wallPrefabs[Random.Range(0, wallPrefabs.Length)]) as MazeWall; wall.Initialize(thatCell, thisCell, direction.GetOposite()); } }
void CreatePassage(MazeCell thisCell, MazeCell thatCell, MazeDirection direction) { MazePassage prefab = Random.value < doorProbabilty ? doorPrefab : passagePrefab; MazePassage passage = Instantiate(prefab) as MazePassage; passage.Initialize(thisCell, thatCell, direction); passage = Instantiate(prefab) as MazePassage; if (passage is MazeDoor) { thatCell.Initialize(CreateRoom(thisCell.room.roomID)); } else { thatCell.Initialize(thisCell.room); } passage.Initialize(thatCell, thisCell, direction.GetOposite()); }