コード例 #1
0
ファイル: TGMap.cs プロジェクト: RobinGraaf/DungeonGame
 void StartGame()
 {
     // Spawn the player on the selected starting point
     TDMap.Room startRoom = map.GetRoom(Random.Range(0, map.GetRooms().Count));
     levelObjects.Add(Instantiate(playerSpawnPoint, new Vector3((startRoom.center.x + 0.5f) * tileSize, (0.5f * tileSize) + 3.0f, (startRoom.center.y + 0.5f) * tileSize), Quaternion.identity));
     GameManager.CreatePlayer(tileSize);
 }
コード例 #2
0
ファイル: TGMap.cs プロジェクト: RobinGraaf/DungeonGame
    private void CreateVerticalWall(TDMap.Room room, float roomLocation, int roomNumber)
    {
        GameObject newWall = Instantiate(wallPrefab, new Vector3((roomLocation) * tileSize, 1.5f * tileSize, wallCenterY), Quaternion.identity, this.transform);

        newWall.transform.localScale = new Vector3(tileSize, tileSize * tileSize, room.height * tileSize);
        newWall.name = "Room " + roomNumber.ToString() + "\t | Vertical wall";
        levelObjects.Add(newWall);
    }
コード例 #3
0
ファイル: TGMap.cs プロジェクト: RobinGraaf/DungeonGame
    void BuildWalls(TDMap.Room room, int roomNumber)
    {
        wallCenterX = room.width % 2 == 0 ? room.center.x * tileSize : (room.center.x + 0.5f) * tileSize;
        wallCenterY = room.height % 2 == 0 ? room.center.y * tileSize : (room.center.y + 0.5f) * tileSize;

        // Horizontal walls
        CreateHorizontalWall(room, room.top + 0.5f, roomNumber);
        CreateHorizontalWall(room, room.bottom + 0.5f, roomNumber);

        // Vertical walls
        CreateVerticalWall(room, room.left + 0.5f, roomNumber);
        CreateVerticalWall(room, room.right - 1.5f, roomNumber);
    }
コード例 #4
0
ファイル: TGMap.cs プロジェクト: RobinGraaf/DungeonGame
    void BuildPortals(TDMap.Room room, int roomNumber)
    {
        if (room.portals[(int)PORTAL.TOP].isConnected)
        {
            CreateNewPortal(room.portals[(int)PORTAL.TOP], room.portalPositionTop, roomNumber);
        }

        if (room.portals[(int)PORTAL.BOTTOM].isConnected)
        {
            CreateNewPortal(room.portals[(int)PORTAL.BOTTOM], room.portalPositionBottom, roomNumber);
        }

        if (room.portals[(int)PORTAL.LEFT].isConnected)
        {
            CreateNewPortal(room.portals[(int)PORTAL.LEFT], room.portalPositionLeft, roomNumber);
        }

        if (room.portals[(int)PORTAL.RIGHT].isConnected)
        {
            CreateNewPortal(room.portals[(int)PORTAL.RIGHT], room.portalPositionRight, roomNumber);
        }
    }
コード例 #5
0
 public void SetRoomConnection(TDMap.Room room)
 {
     connectedToRoom = room;
 }
コード例 #6
0
ファイル: FocusOnRoom.cs プロジェクト: RobinGraaf/DungeonGame
 public void ChangeRoom(TDMap.Room room, float tileSize)
 {
     this.transform.position = new Vector3((room.center.x + 0.5f) * tileSize, 25, (room.center.y + 0.5f) * tileSize);
 }