public void DestroyThirdPartyExperience(ThirdPartyExperienceType type) { AlcovePositionController.getInstance().ResetThirdPartySpawnPoints(CurrentThirdPartyExperience.GetComponent <AlcoveThirdPartyExperience>().m_Data.ExperienceType); if (CurrentThirdPartyExperience.gameObject != null) { PhotonNetwork.Destroy(CurrentThirdPartyExperience.gameObject); } CurrentThirdPartyExperience = null; }
public void ResetThirdPartySpawnPoints(ThirdPartyExperienceType type) { if (type == ThirdPartyExperienceType.Room) { m_ThirdPartyRoomSpawnPoints = _OriginalThirdPartyRoomSpawnPoints; } else if (type == ThirdPartyExperienceType.Tabletop) { m_ThirdPartyTableSpawnPoints = _OriginalThirdPartyTableSpawnPoints; } }
public void SetThirdPartySpawnPoints(GameObject[] spawnPoints, ThirdPartyExperienceType type) { if (type == ThirdPartyExperienceType.Tabletop && spawnPoints != null && spawnPoints.Length > 3) { m_ThirdPartyTableSpawnPoints = spawnPoints; } if (type == ThirdPartyExperienceType.Room && spawnPoints != null && spawnPoints.Length > 3) { m_ThirdPartyRoomSpawnPoints = spawnPoints; } }
public void SetUserPosition(UserPosition position, int posIndex, Action callback = null) { //Check if we need to destroy the room experience if ((CurrentUserPosition == UserPosition.ThirdPartyRoom || CurrentUserPosition == UserPosition.ThirdPartyTable) && position != CurrentUserPosition && AlcoveThirdPartyExperienceController.CurrentThirdPartyExperience != null && AlcoveThirdPartyExperienceController.CurrentThirdPartyExperience.photonView.isMine) { ThirdPartyExperienceType type = CurrentUserPosition == UserPosition.ThirdPartyRoom ? ThirdPartyExperienceType.Room : ThirdPartyExperienceType.Tabletop; NotificationPanel.NotificationData notificationData = new NotificationPanel.NotificationData(); notificationData.AcceptButtonText = "Ok"; notificationData.CancelButtonText = "Cancel"; notificationData.HeaderText = "Leaving game"; notificationData.MessageText = "If you leave the table, the game will end!"; notificationData.AcceptCallback = delegate { AlcoveThirdPartyExperienceController.getInstance().DestroyThirdPartyExperience(type); SetUserPosition(position, callback); }; NotificationPanel.getInstance().ShowNotification(notificationData, true); return; } if (MinorTeleportationLocation.CurrentPositionCollider) { MinorTeleportationLocation.CurrentPositionCollider.enabled = true; } CurrentUserPosition = position; CurrentUserPositionIndex = posIndex; m_CurrentUserPositionTransform = SetObjectPosition(CameraController.CameraContainer, position, posIndex); //Setup room colliders m_FamilyRoomCollider.enabled = CurrentUserPosition != UserPosition.Family; m_EntertainmentAreaCollider.enabled = CurrentUserPosition != UserPosition.Entertainment; m_TravelAreaCollider.enabled = CurrentUserPosition != UserPosition.Travel; m_HealthAreaCollider.enabled = CurrentUserPosition != UserPosition.Health; m_ThirdPartyTableCollider.enabled = CurrentUserPosition != UserPosition.ThirdPartyTable; m_ThirdPartyRoomCollider.enabled = CurrentUserPosition != UserPosition.ThirdPartyRoom; m_ThirdPartyRoomExitCollider.enabled = CurrentUserPosition == UserPosition.ThirdPartyRoom; HideAllTeleportationGraphics(); callback?.Invoke(); if (m_OnPositionChanged != null) { m_OnPositionChanged(CurrentUserPosition, CurrentUserPositionIndex); } }
public void InstantiateThirdPartyExperienceWithNameAndType(string experienceName, ThirdPartyExperienceType type) { Transform instantiationTransform = type == ThirdPartyExperienceType.Tabletop ? m_TableExperienceTransform : m_RoomExperienceTransform; GameObject newExperienceObj = PhotonNetwork.Instantiate(experienceName, instantiationTransform.position, instantiationTransform.rotation, 0, null); AlcoveThirdPartyExperience newExperience = newExperienceObj.GetComponent <AlcoveThirdPartyExperience>(); if (newExperience == null) { Debug.LogError("The root GameObject for an instantiated experience must be assigned the AlcoveThirdPartyExperience component."); } else { CurrentThirdPartyExperience = newExperience; } }