public static void Publish(EventData eventData) { //this prevents the same event being added multiple times within a single update e.g. 10x bell ring sounds if (!uniqueSet.Contains(eventData)) stack.Push(eventData); }
//called when a menu event needs to be generated e.g. click exit protected virtual void OnMainMenu(EventData eventData) { if (MainMenuChanged != null) MainMenuChanged(eventData); }
private void Process(EventData eventData) { //Switch - See https://msdn.microsoft.com/en-us/library/06tc147t.aspx switch(eventData.eventType) { case EventType.OnStart: OnStart(eventData); break; case EventType.OnRotationStart: OnRotationStart(eventData); break; case EventType.OnRotationEnd: OnRotationEnd(eventData); break; case EventType.OnCameraChanged: OnCameraChange(eventData); break; //add a case to handle the On...() method for each type default: switch (eventData.eventCategoryType) { case EventCategoryType.MainMenu: OnMainMenu(eventData); break; } break; } }
public void OnStart(EventData eventData) { if (GameStarted != null) GameStarted(eventData.sender); }
public void OnRotationStart(EventData eventData) { if (RotationStarted != null) RotationStarted(eventData); }
public void OnRotationEnd(EventData eventData) { if (RotationEnd != null) RotationEnd(eventData); }
public void OnCameraChange(EventData eventData) { if (CameraChange != null) CameraChange(eventData); }
private void HandleCameraChanged(EventData eventData) { CameraEventData data = (CameraEventData)eventData; this.SetCamera(data.cameraLayout, data.cameraID); }