private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazePassage prefab; if (Random.value < eventProbability && eventCounter > 0) { //if(eventCounter > 0){ eventCounter--; prefab = eventPrefab; MazePassage chal = Instantiate(prefab) as EventTrigger; chal.Initialize(cell, otherCell, direction); chal.GetComponent <EventTrigger>().SetChallengeManagerRef(challengeManagerInst); prefab = passagePrefab; chal = Instantiate(prefab) as MazePassage; chal.Initialize(otherCell, cell, direction.GetOpposite()); } else { prefab = passagePrefab; //MazePassage prefab = Random.value < doorProbability ? doorPrefab : passagePrefab; MazePassage passage = Instantiate(prefab) as MazePassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(prefab) as MazePassage; passage.Initialize(otherCell, cell, direction.GetOpposite()); } }
private void CreateWallDoor(MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazeWallDoor wall = Instantiate(wallDoorPrefab) as MazeWallDoor; wall.Initialize(cell, otherCell, direction); ColorWallDoor(wall, direction); if (otherCell != null) { wall = Instantiate(wallDoorPrefab) as MazeWallDoor; wall.Initialize(otherCell, cell, direction.GetOpposite()); ColorWallDoor(wall, direction.GetOpposite()); } }
private void CreateWall(MazeCell curCell, MazeCell neighCell, MazeDirection direction) { MazeWall wall = Instantiate(this.wall) as MazeWall; wall.Initialize(curCell, neighCell, direction); wall.name = "MazeWall" + direction; if (neighCell != null) { wall = Instantiate(this.wall) as MazeWall; wall.Initialize(neighCell, curCell, direction.GetOpposite()); wall.name = "MazeWall" + direction.GetOpposite(); } }
private void CreatePassage(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()); }
void CreateNeighbour(Vector2Int neighbourCoordinates, MazeDirection direction) { MazeCell neighbour = CreateCell(neighbourCoordinates); neighbour.RemoveEdge(direction.GetOpposite()); activeCells.Add(neighbour); }
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 (cell.room != otherCell.room && otherCell.room != null) { MazeRoom roomToAssimilate = otherCell.room; cell.room.Assimilate(roomToAssimilate); rooms.Remove(roomToAssimilate); Destroy(roomToAssimilate); } if (passage is MazeDoor) { otherCell.Initialize(CreateRoom(cell.room.settingsIndex)); } else { otherCell.Initialize(cell.room); } passage.Initialize(otherCell, cell, direction.GetOpposite()); }
private void Update() { GunCheck(); ColorGun(); 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)) { Rotate(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E)) { Rotate(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.Space)) { StartCoroutine(Shoot()); } }
private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazePassage prefab = Random.value < doorProbability ? doorPrefab : passagePrefab; //if(prefab == passagePrefab) //{ // prefab = Random.value < ennemyProbability ? ennemyPrefab : passagePrefab; //} MazePassage passage = Instantiate(prefab) as MazePassage; passage.transform.localScale = passage.transform.localScale * scale; passage.Initialize(cell, otherCell, direction); passage = Instantiate(prefab) as MazePassage; passage.transform.localScale = passage.transform.localScale * scale; if (passage is MazeDoor) { otherCell.Initialize(CreateRoom(cell.room.settingsIndex)); } else { otherCell.Initialize(cell.room); } passage.Initialize(otherCell, cell, direction.GetOpposite()); }
private 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()); } }
//private void CreateWall(MazeCell cell, MazeCell otherCell, MazeDirection direction) //{ // MazeWall wall = Instantiate(wallPrefabs[Random.Range(0, wallPrefabs.Length)]) as MazeWall; // wall.transform.localScale = new Vector3(wall.transform.localScale.x * scale, wall.transform.localScale.y * scale, wall.transform.localScale.z * scale); // wall.Initialize(cell, otherCell, direction); // if (otherCell != null) // { // wall = Instantiate(wallPrefabs[Random.Range(0, wallPrefabs.Length)]) as MazeWall; // wall.Initialize(otherCell, cell, direction.GetOpposite()); // //wall.transform.localScale = wall.transform.localScale * scale; // wall.transform.localScale = new Vector3(wall.transform.localScale.x * scale, wall.transform.localScale.y * scale, wall.transform.localScale.z * scale); // } //} private void CreateWall(MazeCell cell, MazeCell otherCell, MazeDirection direction) { int[] nbIterationOfWalls = cell.room.nbWallInRoom; int idx; do { idx = Random.Range(0, nbIterationOfWalls.Length); } while (nbIterationOfWalls[idx] >= cell.room.Settings.nbIterationOfWalls[idx]); MazeWall wall = Instantiate(cell.room.Settings.wallPrefabs[idx]) as MazeWall; nbIterationOfWalls[idx]++; wall.transform.localScale = new Vector3(wall.transform.localScale.x * scale, wall.transform.localScale.y * scale, wall.transform.localScale.z * scale); wall.Initialize(cell, otherCell, direction); if (otherCell != null) { nbIterationOfWalls = otherCell.room.nbWallInRoom; do { idx = Random.Range(0, nbIterationOfWalls.Length); } while (nbIterationOfWalls[idx] >= otherCell.room.Settings.nbIterationOfWalls[idx]); wall = Instantiate(otherCell.room.Settings.wallPrefabs[idx]) as MazeWall; nbIterationOfWalls[idx]++; //wall = Instantiate(wallPrefabs[Random.Range(0, wallPrefabs.Length)]) as MazeWall; wall.Initialize(otherCell, cell, direction.GetOpposite()); //wall.transform.localScale = wall.transform.localScale * scale; wall.transform.localScale = new Vector3(wall.transform.localScale.x * scale, wall.transform.localScale.y * scale, wall.transform.localScale.z * scale); } }
private void CreateWall(MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazeWall wall; if (Random.value < torchProbability && torchCount < torchMax) { wall = Instantiate(torchWallPrefab) as MazeWall; Debug.Log("Torch: " + torchCount); torchCount++; } else { wall = Instantiate(wallPrefab) as MazeWall; } if (wall == null) { Debug.LogError("Wall unable to be instantiated. Check prefabs."); } wall.Initialize(cell, otherCell, direction); if (otherCell != null) { wall = Instantiate(wallPrefab) as MazeWall; wall.Initialize(otherCell, cell, direction.GetOpposite()); } }
private void CreateWall(MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazeWall prefab; if (cell.coordinates.x == 0 || cell.coordinates.x == size.x - 1 || cell.coordinates.z == 0 || cell.coordinates.z == size.z - 1) { prefab = wallPrefab; } else { prefab = Random.value < fakeProb ? fakePrefab : wallPrefab; } MazeWall wall = Instantiate(prefab) as MazeWall; Vector3 scale = wall.transform.localScale; //All walls have same scale wall.Initialize(cell, otherCell, direction); wall.transform.localScale = scale; if (otherCell != null) { wall = Instantiate(prefab) as MazeWall; wall.Initialize(otherCell, cell, direction.GetOpposite()); wall.transform.localScale = scale; } }
private bool CanCreateStairs( MazeCell cell, MazeCell otherCell, MazeDirection direction) { // To create stairs, the strairs must have a altitude 0 low landing cell in the same // room as the stairs, and there must not be an existing cell at the location of the // future high landing cell. bool result = false; if (null != stairsPrefab && 0 == cell.altitude) { IntVector2 lowLandingCoordinates = cell.coordinates + direction.GetOpposite().ToIntVector2(); IntVector2 highLandingCoordinates = otherCell.coordinates + direction.ToIntVector2(); if (ContainsCoordinates(lowLandingCoordinates) && ContainsCoordinates(highLandingCoordinates)) { MazeCell lowLandingCell = GetCell(lowLandingCoordinates); if (null != lowLandingCell && cell.GetRoomNumber() == lowLandingCell.GetRoomNumber() && null == GetCell(highLandingCoordinates)) { result = true; } } } return(result); }
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); Vector3 localScale = new Vector3(1, 1, 1); if (passage is MazeDoor) { passage.transform.localScale = localScale; } passage = Instantiate(prefab) as MazePassage; // create room different from the one of cell ... if (passage is MazeDoor) { passage.transform.localScale = localScale; otherCell.Initialize(CreateRoom(cell.room.settingsIndex)); } // or add next cell to same room else { otherCell.Initialize(cell.room); } passage.Initialize(otherCell, cell, direction.GetOpposite()); }
private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction) { //Create objective every once in a while if (step % 80 == 0) { MazeObjective objective = Instantiate(objectivePrefab); Vector3 size = objective.transform.localScale; objective.transform.parent = cell.transform; objective.transform.localPosition = new Vector3(0, 0.5f, 0); objective.transform.localScale = size; objective.name = "Objective"; objectiveCount++; } //Create passages either in the form of archways or passages MazePassage prefab = Random.value < archProb ? archPrefab : passagePrefab; MazePassage passage = Instantiate(prefab) as MazePassage; Vector3 scale = passage.transform.localScale; //All passages have same scale passage.Initialize(cell, otherCell, direction); passage.transform.localScale = scale; passage = Instantiate(passagePrefab) as MazePassage; passage.Initialize(otherCell, cell, direction.GetOpposite()); passage.transform.localScale = scale; step++; }
private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazePassage prefab = null; if (cell.room.cells.Count > maxRoomSize) { prefab = doorPrefab; } else { prefab = Random.value < doorProbability ? doorPrefab : passagePrefab; } MazePassage passage = Instantiate(prefab, this.transform) as MazePassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(prefab, this.transform) as MazePassage; if (passage is MazeDoor) { otherCell.Initialize(CreateRoom(cell.room.settingsIndex)); } else { otherCell.Initialize(cell.room); } passage.Initialize(otherCell, cell, direction.GetOpposite()); }
// Update is called once per frame void Update() { if (canMove) { 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)) //{ // Rotate(currentDirection.GetNextCounterclockwise()); //} //else if (Input.GetKeyDown(KeyCode.E)) //{ // Rotate(currentDirection.GetNextClockwise()); //} } }
public void EnterCell(MazeCell newCell, MazeDirection direction) { currentCell.OnPlayerExited(direction); currentCell = newCell; transform.localPosition = newCell.transform.localPosition; currentCell.OnPlayerEntered("Player", direction.GetOpposite()); }
// creates a passage between the specified cells private void CreatePassage(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()); }
private void Update() { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.Joystick1Button3)) { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.Joystick1Button1)) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.Joystick1Button0)) { Move(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.Joystick1Button2)) { Move(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.Q) || Input.GetKeyDown(KeyCode.Joystick1Button4)) { Rotate(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Joystick1Button5)) { Rotate(currentDirection.GetNextClockwise()); } }
void Update() { if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W) && !gameOver) { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D) && !gameOver) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S) && !gameOver) { Move(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A) && !gameOver) { Move(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.Q) && !gameOver) { Rotate(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E) && !gameOver) { Rotate(currentDirection.GetNextClockwise()); } }
private void CreatePassage(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 (Random.value < ghostProbabiliy && Ghost.GhostCountGet() < ghostMax && !AtSpawn(cell)) { float temp = Random.Range(0, 3); if (temp >= 0 && temp < 1) { CreateGhost(ghostPrefabRed, cell); } else if (temp >= 1 && temp < 2) { CreateGhost(ghostPrefabBlue, cell); } else { CreateGhost(ghostPrefabGreen, cell); } Debug.Log("Ghosts: " + Ghost.GhostCountGet()); } else if (Random.value < campfireProbability && campfireCount < campfireMax && !AtSpawn(cell)) { CreateCampfire(cell); Debug.Log("Campfire" + campfireCount + " at " + cell.coordinates.x + ", " + cell.coordinates.z); } }
private void Update() { if (Input.GetKeyDown(KeyCode.UpArrow)) { TryMove(currentDirection); } else if (Input.GetKeyDown(KeyCode.RightArrow)) { TryMove(currentDirection.GetNextDirection()); } else if (Input.GetKeyDown(KeyCode.DownArrow)) { TryMove(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.LeftArrow)) { TryMove(currentDirection.GetPrevDirection()); } else if (Input.GetKeyDown(KeyCode.Q)) { Look(currentDirection.GetPrevDirection()); } else if (Input.GetKeyDown(KeyCode.E)) { Look(currentDirection.GetNextDirection()); } else if (Input.GetKeyDown(KeyCode.W)) { TryOperateDoor(currentDirection); } }
// create a wall between two cells private void CreateWall(MazeCell firstCell, MazeCell secondCell, MazeDirection direction) { // use perlin noise to calculate wall type float generatedNoise; if (secondCell == null) { generatedNoise = 1; } else { generatedNoise = Mathf.PerlinNoise((firstCell.coordinates.x * secondCell.coordinates.x) / (float)mazeGenerationNumber, (firstCell.coordinates.z * secondCell.coordinates.z) / (float)mazeGenerationNumber); } MazeWall prefabType; // torch if (generatedNoise < 0.27) { prefabType = wallPrefabs[1]; } else { prefabType = wallPrefabs[0]; } // set the wall type MazeWall wall = Instantiate(prefabType) as MazeWall; wall.Initialize(firstCell, secondCell, direction); // instantiate it again for the other cell (if it exists) if (secondCell != null) { wall = Instantiate(prefabType) as MazeWall; wall.Initialize(secondCell, firstCell, direction.GetOpposite()); } // set the wall type, initialize with photon /* * GameObject newWall; * Vector3 newWallPos = new Vector3(0, 0, 0); * Quaternion newWallRot = new Quaternion(0f, 0f, 0f, 0f); * if (generatedNoise < 0.2){ * newWall = (GameObject) PhotonNetwork.Instantiate("MazeWallTorch", newWallPos, newWallRot, 0); * } * else{ * newWall = (GameObject) PhotonNetwork.Instantiate("MazeWall", newWallPos, newWallRot, 0); * } * MazeWall wall = newWall.GetComponent<MazeWall>(); * wall.Initialize(firstCell, secondCell, direction); * // instantiate it again for the other cell (if it exists) * if (secondCell != null) { * newWall = (GameObject) PhotonNetwork.Instantiate("MazeWall", newWallPos, newWallRot, 0); * wall = newWall.GetComponent<MazeWall>(); * wall.Initialize(secondCell, firstCell, direction.GetOpposite()); * } */ }
/** * create instance of wall and passage */ private void CreatePassage(MazeCell source, MazeCell sink, MazeDirection direction) { MazePassage passage = Instantiate(passagePrefab) as MazePassage; passage.Initialize(source, sink, direction); passage = Instantiate(passagePrefab) as MazePassage; passage.Initialize(sink, source, direction.GetOpposite()); }
void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction) //creates empty passage between two cells and initializes it for both sides { MazePassage passage = Instantiate(passagePrefab) as MazePassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(passagePrefab) as MazePassage; passage.Initialize(otherCell, cell, direction.GetOpposite()); }
void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction) { var passage = Instantiate(passagePrefab) as MazePassage; passage.Initialize(cell, otherCell, direction, EdgeType.passage); passage = Instantiate(EmptyPassage) as MazePassage; passage.Initialize(otherCell, cell, direction.GetOpposite(), EdgeType.passage); }
private void CreatePassage(MazeCell curCell, MazeCell neighCell, MazeDirection direction) { MazePath passage = Instantiate(this.path) as MazePath; passage.Initialize(curCell, neighCell, direction); passage = Instantiate(this.path) as MazePath; passage.Initialize(neighCell, curCell, direction.GetOpposite()); }
private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction, int type = 2) { MazePassage prefab = type == 3 ? doorPrefab : passagePrefab; MazePassage passage = Instantiate(prefab) as MazePassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(prefab) as MazePassage; passage.Initialize(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()); } }
private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazeCellPassage prefab = Random.value < doorProbability ? this.DoorPrefab : this.PassagePrefab; MazeCellPassage passage = Instantiate(prefab) as MazeCellPassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(prefab) as MazeCellPassage; passage.Initialize(otherCell, cell, direction.GetOpposite()); }
private void CreateWall(MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazeWall wall = Instantiate(wallPrefab) as MazeWall; wall.Initialize(cell, otherCell, direction); if (otherCell != null) { wall = Instantiate(wallPrefab) as MazeWall; wall.Initialize(otherCell, cell, direction.GetOpposite()); } }
public 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()); } }
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()); }
private void GeneratePassageSameRoom (MazeCell cell, MazeCell otherCell, MazeDirection direction) { var prefab = maze.passagePrefab; MazePassage passage = Maze.Instantiate(prefab) as MazePassage; passage.Initialize(cell, otherCell, direction); passage = Maze.Instantiate(prefab) as MazePassage; passage.Initialize (otherCell, cell, direction.GetOpposite ()); if (cell.room != otherCell.room) RoomAssimilation (cell, otherCell); }
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 CreateWall(MazeCell cell, MazeCell otherCell, MazeDirection direction) { int randNum = Random.Range (0, 20); if (randNum == 0) { randNum = 1; } else { randNum = 0; } MazeWall wall = Instantiate(wallPrefabs[randNum]) as MazeWall; wall.Initialize(cell, otherCell, direction); if (otherCell != null) { wall = Instantiate(wallPrefabs[randNum]) as MazeWall; wall.Initialize(otherCell, cell, direction.GetOpposite()); } }
public void WallGeneration (MazeCell cell, MazeCell otherCell, MazeDirection direction, int[] randomNumbers) { MazeWall wall = Maze.Instantiate (maze.wallSettings.wallPrefabs [randomNumbers[0]]) as MazeWall; wall.Initialize (cell, otherCell, direction); if (otherCell == null) return; wall = Maze.Instantiate (maze.wallSettings.wallPrefabs [randomNumbers[1]]) as MazeWall; wall.Initialize (otherCell, cell, direction.GetOpposite ()); }
private void GeneratePassageDifferentRoom (MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazePassage prefab; if (maze.MaxDoorNumber == 0) prefab = GetMazePassageBasedOnDoorPropability (); else prefab = GetMazePassageBasedOnMaxDoorNumber (cell); MazePassage passage = Maze.Instantiate(prefab) as MazePassage; passage.Initialize(cell, otherCell, direction); passage = Maze.Instantiate(prefab) as MazePassage; DifferentRoomAction (cell, otherCell, passage); passage.Initialize (otherCell, cell, direction.GetOpposite ()); }