public RoomInfo(IntPtr obj) { objPtr = obj; List <ChatMessage> csMessageList = new List <ChatMessage>(); int nMessageListSize = 0; IntPtr nMessageList = VidyoRoomInfoGetmessageListArrayNative(VidyoRoomInfoGetmessageListNative(objPtr), ref nMessageListSize); int nMessageListIndex = 0; while (nMessageListIndex < nMessageListSize) { ChatMessage csTmessageList = new ChatMessage(Marshal.ReadIntPtr(nMessageList + (nMessageListIndex * Marshal.SizeOf(nMessageList)))); csMessageList.Add(csTmessageList); nMessageListIndex++; } List <String> csOwnerList = new List <String>(); int nOwnerListSize = 0; IntPtr nOwnerList = VidyoRoomInfoGetownerListArrayNative(VidyoRoomInfoGetownerListNative(objPtr), ref nOwnerListSize); int nOwnerListIndex = 0; while (nOwnerListIndex < nOwnerListSize) { csOwnerList.Add((string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(Marshal.ReadIntPtr(nOwnerList + (nOwnerListIndex * Marshal.SizeOf(nOwnerList))))); nOwnerListIndex++; } List <String> csUserList = new List <String>(); int nUserListSize = 0; IntPtr nUserList = VidyoRoomInfoGetuserListArrayNative(VidyoRoomInfoGetuserListNative(objPtr), ref nUserListSize); int nUserListIndex = 0; while (nUserListIndex < nUserListSize) { csUserList.Add((string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(Marshal.ReadIntPtr(nUserList + (nUserListIndex * Marshal.SizeOf(nUserList))))); nUserListIndex++; } creationTime = VidyoRoomInfoGetcreationTimeNative(objPtr); description = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoRoomInfoGetdescriptionNative(objPtr)); extension = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoRoomInfoGetextensionNative(objPtr)); id = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoRoomInfoGetidNative(objPtr)); isFavorite = VidyoRoomInfoGetisFavoriteNative(objPtr); isMembersOnly = VidyoRoomInfoGetisMembersOnlyNative(objPtr); isPasswordProtected = VidyoRoomInfoGetisPasswordProtectedNative(objPtr); isPublic = VidyoRoomInfoGetisPublicNative(objPtr); language = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoRoomInfoGetlanguageNative(objPtr)); maxParticipants = VidyoRoomInfoGetmaxParticipantsNative(objPtr); messageList = csMessageList; name = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoRoomInfoGetnameNative(objPtr)); numUsers = VidyoRoomInfoGetnumUsersNative(objPtr); ownerList = csOwnerList; type = VidyoRoomInfoGettypeNative(objPtr); userList = csUserList; VidyoRoomInfoFreeuserListArrayNative(nUserList, nUserListSize); VidyoRoomInfoFreeownerListArrayNative(nOwnerList, nOwnerListSize); VidyoRoomInfoFreemessageListArrayNative(nMessageList, nMessageListSize); }
public RoomInfo(IntPtr obj) { objPtr = obj; List <ChatMessage> csMessageList = new List <ChatMessage>(); int nMessageListSize = 0; IntPtr nMessageList = VidyoRoomInfoGetmessageListArrayNative(VidyoRoomInfoGetmessageListNative(objPtr), ref nMessageListSize); int nMessageListIndex = 0; while (nMessageListIndex < nMessageListSize) { ChatMessage csTmessageList = new ChatMessage(Marshal.ReadIntPtr(nMessageList + (nMessageListIndex * Marshal.SizeOf(nMessageList)))); csMessageList.Add(csTmessageList); nMessageListIndex++; } List <String> csOwnerList = new List <String>(); int nOwnerListSize = 0; IntPtr nOwnerList = VidyoRoomInfoGetownerListArrayNative(VidyoRoomInfoGetownerListNative(objPtr), ref nOwnerListSize); int nOwnerListIndex = 0; while (nOwnerListIndex < nOwnerListSize) { csOwnerList.Add(Marshal.PtrToStringAnsi(Marshal.ReadIntPtr(nOwnerList + (nOwnerListIndex * Marshal.SizeOf(nOwnerList))))); nOwnerListIndex++; } List <String> csUserList = new List <String>(); int nUserListSize = 0; IntPtr nUserList = VidyoRoomInfoGetuserListArrayNative(VidyoRoomInfoGetuserListNative(objPtr), ref nUserListSize); int nUserListIndex = 0; while (nUserListIndex < nUserListSize) { csUserList.Add(Marshal.PtrToStringAnsi(Marshal.ReadIntPtr(nUserList + (nUserListIndex * Marshal.SizeOf(nUserList))))); nUserListIndex++; } IsFavorite = VidyoRoomInfoGetIsFavoriteNative(objPtr); IsPublic = VidyoRoomInfoGetIsPublicNative(objPtr); creationTime = VidyoRoomInfoGetcreationTimeNative(objPtr); description = Marshal.PtrToStringAnsi(VidyoRoomInfoGetdescriptionNative(objPtr)); id = Marshal.PtrToStringAnsi(VidyoRoomInfoGetidNative(objPtr)); language = Marshal.PtrToStringAnsi(VidyoRoomInfoGetlanguageNative(objPtr)); messageList = csMessageList; name = Marshal.PtrToStringAnsi(VidyoRoomInfoGetnameNative(objPtr)); numUsers = VidyoRoomInfoGetnumUsersNative(objPtr); ownerList = csOwnerList; type = VidyoRoomInfoGettypeNative(objPtr); userList = csUserList; VidyoRoomInfoFreeuserListArrayNative(nUserList, nUserListSize); VidyoRoomInfoFreeownerListArrayNative(nOwnerList, nOwnerListSize); VidyoRoomInfoFreemessageListArrayNative(nMessageList, nMessageListSize); }
private void InstantiateRoom(RoomData roomData, List <Room> possibleRooms, Room.RoomType type = Room.RoomType.Basic) { Room roomInstance = Instantiate(possibleRooms[Random.Range(0, possibleRooms.Count)], _levelGrid.transform); roomInstance.Init(roomData, type); Vector2 actualPosition = new Vector2(roomData.GridPosition.x * _cellSize.x * GameSettings.Instance.RoomWidth, roomData.GridPosition.y * _cellSize.y * GameSettings.Instance.RoomHeight); actualPosition += -1 * roomInstance.UpperLeftCorner + new Vector2(roomData.GridPosition.x * _offsetBetweenRooms, roomData.GridPosition.y * _offsetBetweenRooms); roomInstance.transform.position = actualPosition; _roomDictionary.Add(roomData, roomInstance); }
public int MyScore(Room.RoomType type) { if (type == Room.RoomType.Player1) { return(player1Rating); } else if (type == Room.RoomType.Player2) { return(player2Rating); } else { return(player1Rating + player2Rating); } }
/// <summary> /// Will generate special rooms, such as the boss room, and handle the spawning behavior /// </summary> /// <param name="intX">Initial X of floor</param> /// <param name="intY">Initial Y of floor</param> /// <param name="rt">Room Type to spawn</param> void GenerateSpecialRoom(int intX, int intY, Room.RoomType rt) { GameObject room; if (rt == Room.RoomType.SHOP || rt == Room.RoomType.BOSS) { List <Vector2> potentialLoc = GetPotentialEndRooms(intX, intY); int pickedSpawn = Random.Range(0, potentialLoc.Count); if (rt == Room.RoomType.SHOP) { room = Instantiate(potentialShopRoomSpawns[0]); room.gameObject.name = "SHOP"; room.GetComponent <Room>().ClearRoom(); } else { room = Instantiate(potentialBossRoomSpawns[0]); room.gameObject.name = "BOSS"; } room.transform.position = new Vector3(potentialLoc[pickedSpawn].x * nodeLength, 0, potentialLoc[pickedSpawn].y * nodeLength); roomArray[(int)potentialLoc[pickedSpawn].x, (int)potentialLoc[pickedSpawn].y].isTaken = true; createdRooms.Add(roomArray[(int)potentialLoc[pickedSpawn].x, (int)potentialLoc[pickedSpawn].y]); roomArray[(int)potentialLoc[pickedSpawn].x, (int)potentialLoc[pickedSpawn].y].room = room; room.GetComponent <Room>().roomType = rt; } else if (rt == Room.RoomType.START) { room = Instantiate(potentialRoomSpawns[0]); room.transform.position = new Vector3(intX * nodeLength, 0, intY * nodeLength); GameManager.gm.playerMovement.Warp(new Vector3(room.transform.position.x, 2, room.transform.position.z)); currentRoom = room.GetComponent <Room>(); createdRooms.Add(roomArray[intX, intY]); roomArray[intX, intY].room = room; room.GetComponent <Room>().roomType = rt; } }
// Get Sprites todo public Sprite getIcon(Room.RoomType type) { if (icon != null) { icon.enabled = true; switch (type) { case Room.RoomType.START_ROOM: return(Resources.Load <Sprite>("UI/Health")); case Room.RoomType.ENEMIE_ROOM: break; case Room.RoomType.BOSS_ROOM: return(Resources.Load <Sprite>("UI/Passive")); case Room.RoomType.SPECIAL_ROOM: return(Resources.Load <Sprite>("UI/Stamina")); } } return(null); }
public Room CreateRoom(int[] coordinates, Room.RoomType prevRoomType) { return(new CombatRoom(coordinates[0], coordinates[1], new Door())); }
void SpawnRoom(Room.RoomType type, string direction) { Vector3 offset = new Vector3(); switch (type) { case Room.RoomType.HallwayHorizontal: tempRoomObject = Instantiate(hallwayHorizontal, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); break; case Room.RoomType.HallwayVertical: tempRoomObject = Instantiate(hallwayVertical, new Vector3(0, 0, 0), Quaternion.Euler(0, 90f, 0)); break; case Room.RoomType.BigRoom: rnd = Random.Range(0, 4); tempRoomObject = Instantiate(bigRoom[rnd], new Vector3(0, 0, 0), Quaternion.Euler(0, GetRoomRotation(rnd), 0)); bigRoomsCreated++; break; case Room.RoomType.ChamberHorizontal: tempRoomObject = Instantiate(chamberHorizontal, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); break; case Room.RoomType.ChamberVertical: tempRoomObject = Instantiate(chamberVertical, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); break; case Room.RoomType.EndEast: tempRoomObject = Instantiate(endEast, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); break; case Room.RoomType.EndWest: tempRoomObject = Instantiate(endWest, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); break; case Room.RoomType.EndNorth: tempRoomObject = Instantiate(endNorth, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); break; case Room.RoomType.EndSouth: tempRoomObject = Instantiate(endSouth, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); break; case Room.RoomType.EndRoomEast: tempRoomObject = Instantiate(endRoomEast, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); endRoomCount++; break; case Room.RoomType.EndRoomWest: tempRoomObject = Instantiate(endRoomWest, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); endRoomCount++; break; case Room.RoomType.EndRoomNorth: tempRoomObject = Instantiate(endRoomNorth, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); endRoomCount++; break; case Room.RoomType.EndRoomSouth: tempRoomObject = Instantiate(endRoomSouth, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); endRoomCount++; break; default: break; } //Align room to connection points switch (direction) { case "east": offset = tempRoomObject.GetComponent <Room>().westConnection.transform.position - currentRoom.GetComponent <Room>().eastConnection.transform.position; tempRoomObject.transform.position -= offset; // Confirm connection currentRoom.eastConnected = true; tempRoomObject.GetComponent <Room>().westConnected = true; break; case "west": offset = tempRoomObject.GetComponent <Room>().eastConnection.transform.position - currentRoom.GetComponent <Room>().westConnection.transform.position; tempRoomObject.transform.position -= offset; // Confirm connection currentRoom.westConnected = true; tempRoomObject.GetComponent <Room>().eastConnected = true; break; case "north": offset = tempRoomObject.GetComponent <Room>().southConnection.transform.position - currentRoom.GetComponent <Room>().northConnection.transform.position; tempRoomObject.transform.position -= offset; // Confirm connection currentRoom.northConnected = true; tempRoomObject.GetComponent <Room>().southConnected = true; break; case "south": offset = tempRoomObject.GetComponent <Room>().northConnection.transform.position - currentRoom.GetComponent <Room>().southConnection.transform.position; tempRoomObject.transform.position -= offset; // Confirm connection currentRoom.southConnected = true; tempRoomObject.GetComponent <Room>().northConnected = true; break; case "start": break; } tempRoomObject.transform.parent = levelObject.transform; roomsToConnect.Add(tempRoomObject.GetComponent <Room>()); roomsCreated++; }
void SpawnRoom(Room.RoomType type, string direction) { Vector3 offset = new Vector3(); //Instantiate room object switch (type) { case Room.RoomType.VerticalCorridor: tempRoomObject = Instantiate(verticalCorridor, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); CountRoom(currentRoom, tempRoomObject.GetComponent <Room>()); break; case Room.RoomType.HorizontalCorridor: tempRoomObject = Instantiate(horizontalCorridor, new Vector3(0, 0, 0), Quaternion.Euler(0, 90, 0)); break; case Room.RoomType.CornerEN: tempRoomObject = Instantiate(cornerEN, new Vector3(0, 0, 0), Quaternion.Euler(0, -90, 0)); CountRoom(currentRoom, tempRoomObject.GetComponent <Room>()); break; case Room.RoomType.CornerES: tempRoomObject = Instantiate(cornerES, new Vector3(0, 0, 0), Quaternion.Euler(0, 180, 0)); CountRoom(currentRoom, tempRoomObject.GetComponent <Room>()); break; case Room.RoomType.CornerWN: tempRoomObject = Instantiate(cornerWN, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); CountRoom(currentRoom, tempRoomObject.GetComponent <Room>()); break; case Room.RoomType.CornerWS: tempRoomObject = Instantiate(cornerWS, new Vector3(0, 0, 0), Quaternion.Euler(0, 90, 0)); CountRoom(currentRoom, tempRoomObject.GetComponent <Room>()); break; case Room.RoomType.MachineRoomNorth: tempRoomObject = Instantiate(machineRoomNorth, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); break; case Room.RoomType.MachineRoomEast: tempRoomObject = Instantiate(machineRoomEast, new Vector3(0, 0, 0), Quaternion.Euler(0, 90, 0)); break; case Room.RoomType.MachineRoomSouth: tempRoomObject = Instantiate(machineRoomSouth, new Vector3(0, 0, 0), Quaternion.Euler(0, 180, 0)); break; case Room.RoomType.MachineRoomWest: tempRoomObject = Instantiate(machineRoomWest, new Vector3(0, 0, 0), Quaternion.Euler(0, -90, 0)); break; case Room.RoomType.BreakRoomNorth: tempRoomObject = Instantiate(breakRoomNorth, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); break; case Room.RoomType.BreakRoomEast: tempRoomObject = Instantiate(breakRoomEast, new Vector3(0, 0, 0), Quaternion.Euler(0, 90, 0)); break; case Room.RoomType.BreakRoomSouth: tempRoomObject = Instantiate(breakRoomSouth, new Vector3(0, 0, 0), Quaternion.Euler(0, 180, 0)); break; case Room.RoomType.BreakRoomWest: tempRoomObject = Instantiate(breakRoomWest, new Vector3(0, 0, 0), Quaternion.Euler(0, -90, 0)); break; case Room.RoomType.BossRoom: tempRoomObject = Instantiate(bossRoom, new Vector3(0, 0, 0), Quaternion.Euler(0, 180, 0)); break; case Room.RoomType.BigRoomCross: tempRoomObject = Instantiate(bigRoomCross, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); bigRoomsCreated++; tempRoomObject.GetComponent <Room>().bigRoomArmNr = bigRoomsCreated; break; default: break; } CountRoom(currentRoom, tempRoomObject.GetComponent <Room>()); //Align room to connection points switch (direction) { case "east": offset = tempRoomObject.GetComponent <Room>().westConnection.transform.position - currentRoom.GetComponent <Room>().eastConnection.transform.position; tempRoomObject.transform.position -= offset; // Confirm connection currentRoom.eastConnected = true; tempRoomObject.GetComponent <Room>().westConnected = true; break; case "west": offset = tempRoomObject.GetComponent <Room>().eastConnection.transform.position - currentRoom.GetComponent <Room>().westConnection.transform.position; tempRoomObject.transform.position -= offset; // Confirm connection currentRoom.westConnected = true; tempRoomObject.GetComponent <Room>().eastConnected = true; break; case "north": offset = tempRoomObject.GetComponent <Room>().southConnection.transform.position - currentRoom.GetComponent <Room>().northConnection.transform.position; tempRoomObject.transform.position -= offset; // Confirm connection currentRoom.northConnected = true; tempRoomObject.GetComponent <Room>().southConnected = true; break; case "south": offset = tempRoomObject.GetComponent <Room>().northConnection.transform.position - currentRoom.GetComponent <Room>().southConnection.transform.position; tempRoomObject.transform.position -= offset; // Confirm connection currentRoom.southConnected = true; tempRoomObject.GetComponent <Room>().northConnected = true; break; default: break; } //Parent object to level object tempRoomObject.transform.parent = levelObject.transform; roomsToConnect.Add(tempRoomObject.GetComponent <Room>()); roomsCreated++; }
public RoomCell(Room.RoomType type, Room room) { Type = type; Reference = room; }
void SetTipo(int index) { Vector3 position = posicoes[index].position; Room.RoomType tipo = GetTipo(index % width); string log = ""; switch (tipo) { case Room.RoomType.Esquerda: if (index == 0) { // log = "Canto Superior Esquerdo"; Instantiate(rooms[0], position, Quaternion.identity); } else if ((width * height) - width == index) { Instantiate(rooms[2], position, Quaternion.identity); // log = "Canto Inferior Esquerdo"; } else { Instantiate(rooms[1], position, Quaternion.identity); // log = "Canto Centro Esquerdo"; } break; case Room.RoomType.Centro: if (width - index > 0) { Instantiate(rooms[3], position, Quaternion.identity); // log = "Centro Superior"; } else if (index % width == 0) { Instantiate(rooms[1], position, Quaternion.identity); // log = "Centro Esquerdo"; } else if (index % width == width - 1) { Instantiate(rooms[6], position, Quaternion.identity); // log = "Centro Direito"; } else if (index > width * height - width) { Instantiate(rooms[4], position, Quaternion.identity); // log = "Centro Baixo"; } else { Instantiate(rooms[8], position, Quaternion.identity); // log = "Centro"; } break; case Room.RoomType.Direita: if (width - 1 == index) { Instantiate(rooms[5], position, Quaternion.identity); // log = "Canto Superior Direito"; } else if (width * height - 1 == index) { Instantiate(rooms[7], position, Quaternion.identity); // log = "Canto Inferior Direito"; } else { Instantiate(rooms[6], position, Quaternion.identity); // log = "Canto Centro Direito"; } break; default: log = "Error! Combinacao nao encontrada"; break; } // Debug.Log(log + ", index: " + index); }
public static void PlaceRoom(Tile StartPoint, Tile EndPoint, Room.RoomType typeOfroom) { SetBorders(StartPoint, EndPoint); }