Ejemplo n.º 1
0
    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());
        }
    }
Ejemplo n.º 2
0
 private void ColorWallDoor(MazeWallDoor wall, MazeDirection direction)
 {
     if (direction == MazeDirection.North)
     {
         wall.GetComponentInChildren <Renderer>().material = wallColors[0];
     }
     else if (direction == MazeDirection.East)
     {
         wall.GetComponentInChildren <Renderer>().material = wallColors[1];
     }
     else if (direction == MazeDirection.South)
     {
         wall.GetComponentInChildren <Renderer>().material = wallColors[2];
     }
     else if (direction == MazeDirection.West)
     {
         wall.GetComponentInChildren <Renderer>().material = wallColors[3];
     }
 }