Exemplo n.º 1
0
    private void CreateWall(LevelCell cell, LevelCell otherCell, LevelDirection direction, Canvas twoDMap)
    {
        LevelWall wall = Instantiate(wallPrefab) as LevelWall;

        wall.Initialize(cell, otherCell, direction);
        if (otherCell != null)
        {
            wall = Instantiate(wallPrefab) as LevelWall;
            wall.Initialize(otherCell, cell, direction.GetOpposite());
        }
        CreateTwoDWall(cell, twoDMap, direction);
    }
Exemplo n.º 2
0
    private void CreateBreakableWall(LevelCell cell, LevelCell otherCell, LevelDirection direction, Canvas twoDMap)
    {
        LevelBreakableWall wall = Instantiate(breakableWallPrefab) as LevelBreakableWall;

        wall.material = breakableMats[cell.room.matIndex];
        wall.Initialize(cell, otherCell, direction);
        breakableWalls.Add(wall);
        LevelBreakableWall otherWall = Instantiate(breakableWallPrefab) as LevelBreakableWall;

        otherWall.material = breakableMats[otherCell.room.matIndex];
        otherWall.Initialize(otherCell, cell, direction.GetOpposite());
        breakableWalls.Add(otherWall);
        CreateTwoDWall(cell, twoDMap, direction);
    }
Exemplo n.º 3
0
    private void CreatePassageInSameRoom(LevelCell cell, LevelCell otherCell, LevelDirection direction, Canvas twoDMap)
    {
        LevelPassage passage = Instantiate(passagePrefab) as LevelPassage;

        passage.Initialize(cell, otherCell, direction);
        passage = Instantiate(passagePrefab) as LevelPassage;
        passage.Initialize(otherCell, cell, direction.GetOpposite());
        if (cell.room != otherCell.room)
        {
            LevelRoom joinRoom = otherCell.room;
            cell.room.Join(joinRoom);
            rooms.Remove(joinRoom);
            Destroy(joinRoom);
        }
        CreateTwoDPassage(cell, twoDMap, direction);
    }
Exemplo n.º 4
0
    private void CreatePassage(LevelCell cell, LevelCell otherCell, LevelDirection direction, Canvas twoDMap, bool existingCell)
    {
        LevelPassage passage = Instantiate(passagePrefab) as LevelPassage;

        passage.Initialize(cell, otherCell, direction);
        passage = Instantiate(passagePrefab) as LevelPassage;
        if (!existingCell)
        {
            if (Random.value < newRoomProbability)
            {
                otherCell.InitializeCell(CreateRoom(cell.room.matIndex));
            }
            else
            {
                otherCell.InitializeCell(cell.room);
            }
            CreateTwoDCell(otherCell, twoDMap);
        }
        passage.Initialize(otherCell, cell, direction.GetOpposite());
        CreateTwoDPassage(cell, twoDMap, direction);
    }