//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Helper Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Called whenever the syncedUsername dictionary changes private void OnUsernameChanged(NetworkedDictionaryEvent <int, string> changeEvent) { //Debug.Log(string.Format("Username Changed Event Type:{0} Key:{1} Value{2}", changeEvent.GetType().ToString(), changeEvent.key, changeEvent.value)); if (DoesPlayerExist(changeEvent.key)) { if (NetworkingManager.Singleton.IsHost || NetworkingManager.Singleton.IsServer) { SetScore(changeEvent.key, 0); Debug.Log("Setting score to 0 after new user added, playernum: " + changeEvent.key.ToString()); } } SessionManager.Singleton?.PlayerStateChangedCallback?.Invoke(); }
//Called whenever the syncedScores dictionary changes private void OnScoreChanged(NetworkedDictionaryEvent <int, int> changeEvent) { SessionManager.Singleton?.PlayerScoreChangedCallback?.Invoke(); }
//Called whenever the snycedControllerAssignments dictionary changes private void OnControllerAssignmentChanged(NetworkedDictionaryEvent <int, int> changeEvent) { //Debug.Log("Character controller Assignment changed: " + changeEvent.key + " : " + changeEvent.value); SessionManager.Singleton?.PlayerStateChangedCallback?.Invoke(); }
//Called whenever the syncedCharacterNames dictionary changes private void OnCharacterNameChanged(NetworkedDictionaryEvent <int, string> changeEvent) { SessionManager.Singleton?.PlayerStateChangedCallback?.Invoke(); }