private static void ProcessAgentResponse(HeartbeatResponse heartBeat) { SessionConfig.CopyNonNullFields(heartBeat.SessionConfig); if (!string.IsNullOrEmpty(heartBeat.NextScheduledMaintenanceUtc)) { DateTime scheduledMaintDate; if (DateTime.TryParse( heartBeat.NextScheduledMaintenanceUtc, null, DateTimeStyles.RoundtripKind, out scheduledMaintDate)) { if (OnMaintenanceCallback != null) { OnMaintenanceCallback.Invoke(scheduledMaintDate); } } } switch (heartBeat.Operation) { case GameOperation.Continue: //No Action Required. break; case GameOperation.Active: //Transition Server State to Active. CurrentState.CurrentGameState = GameState.Active; _configMap.Add(SessionIdKey, heartBeat.SessionConfig.SessionId); _configMap.Add(SessionCookieKey, heartBeat.SessionConfig.SessionCookie); if (OnServerActiveCallback != null) { OnServerActiveCallback.Invoke(); } break; case GameOperation.Terminate: if (CurrentState.CurrentGameState == GameState.Terminated) { break; } //Transition Server to a Termination state. CurrentState.CurrentGameState = GameState.Terminating; if (OnShutDownCallback != null) { OnShutDownCallback.Invoke(); } break; default: Debug.LogWarning("Unknown operation received" + heartBeat.Operation); break; } if (IsDebugging) { Debug.LogFormat("Operation: {0}, Maintenance:{1}, State: {2}", heartBeat.Operation, heartBeat.NextScheduledMaintenanceUtc, CurrentState.CurrentGameState); } }