protected override void handleSessionMessage(PartyGameSessionMessageTypes type, string data) { switch (type) { case PartyGameSessionMessageTypes.SetRole: { PartyGameSessionMessages.SetRole setRole = jsonService.Deserialize <PartyGameSessionMessages.SetRole>(data); role = (ScavengerHuntRoles)setRole.RoleId; scavengerHuntData.LocalPlayerRole = role; scavengerHuntData.OtherPlayerRole = ((role == ScavengerHuntRoles.Hider) ? ScavengerHuntRoles.Finder : ScavengerHuntRoles.Hider); break; } case PartyGameSessionMessageTypes.SetGameState: { PartyGameSessionMessages.SetGameState setGameState = jsonService.Deserialize <PartyGameSessionMessages.SetGameState>(data); ScavengerHuntState gameStateId = (ScavengerHuntState)setGameState.GameStateId; changeState(gameStateId); break; } case PartyGameSessionMessageTypes.RemoveItem: handleRemoveItem(jsonService.Deserialize <PartyGameSessionMessages.RemoveItem>(data)); break; case PartyGameSessionMessageTypes.AddItem: handleAddItem(jsonService.Deserialize <PartyGameSessionMessages.AddItem>(data)); break; } }
private void changeState(ScavengerHuntState newState) { currentState = newState; switch (newState) { case ScavengerHuntState.AwaitingRoles: startAwaitingRoles(); break; case ScavengerHuntState.Hiding: startHiding(); EventManager.Instance.PostEvent("SFX/AO/MarbleHunt/RoleAccepted", EventAction.PlaySound); break; case ScavengerHuntState.Finding: startFinding(); EventManager.Instance.PostEvent("SFX/AO/MarbleHunt/RoleAccepted", EventAction.PlaySound); break; } }