private void Update() { if (State == InteractState.Grabbed) { door?.SetByHandPosition(hand); Events.FireEvent(EventType.HandleGrabbed, CallbackData.NoData()); } }
private static void CallDefaultCallbacks(EventType type, CallbackData?data = null) { try { if (!eventsData.ContainsKey(type)) { return; } (eventsData[type] as EventDataCallback)?.Invoke(data ?? CallbackData.NoData()); } catch (Exception e) { Logger.Error("Failed to execute event callbacks: " + e.Message + "\n\nError stack trace:\n" + e.StackTrace + "\n\n"); } }
/// <summary> /// Calls all callbacks for event /// </summary> /// <param name="type"></param> public static void FireEvent(EventType type) { CallDefaultCallbacks(type); CallComponentCallbacks(type, CallbackData.NoData()); }