public void TriggerHidden() { Debug.Log("Triggering hidden dialogue"); if (hiddenTriggerOptionalEventOnEnd.GetPersistentEventCount() >= 1) { SingletonDialogueController.instance.BindEventToDialogueComplete(hiddenTriggerOptionalEventOnEnd); } SingletonDialogueController.instance.StartDialogue(hiddenDialogue); }
public void Drop() { drop.Invoke(); if (drop.GetPersistentEventCount() == 0) { DefaultDrop(); } parent = null; }
/// <summary> /// Function called by Action scriptable object when the action is raised /// </summary> public void OnActionRaised() { if (_Response.GetPersistentEventCount() == 0) { Logger.Log(Logger.Type.Warning, "_Response doesn't have any listener...", this); } _Response?.Invoke(); }
public void Drop() { drop.Invoke(); if (drop.GetPersistentEventCount() == 0) // Checks how many listeners you've added -- if zero, runs the default { DefaultDrop(); } parent = null; }
public void Trigger() { Debug.Log("Triggering normal dialogue"); if (triggerOptionalEventsOnEnd.GetPersistentEventCount() >= 1) { SingletonDialogueController.instance.BindEventToDialogueComplete(triggerOptionalEventsOnEnd); } SingletonDialogueController.instance.StartDialogue(dialogue); }
public void Drop() { DropEvent.Invoke(); if (DropEvent.GetPersistentEventCount() == 0) { DefaultDrop(); } ActiveHand = null; }
public void EventRaised() { // default/generic if (response.GetPersistentEventCount() >= 1) // always check if at least 1 object is listening for the event { response.Invoke(); } // string if (responseForSentString.GetPersistentEventCount() >= 1) { responseForSentString.Invoke(gameEvent.sentString); } // int if (responseForSentInt.GetPersistentEventCount() >= 1) { responseForSentInt.Invoke(gameEvent.sentInt); } // float if (responseForSentFloat.GetPersistentEventCount() >= 1) { responseForSentFloat.Invoke(gameEvent.sentFloat); } // bool if (responseForSentBool.GetPersistentEventCount() >= 1) { responseForSentBool.Invoke(gameEvent.sentBool); } // Vector2 if (responseForSentVector2.GetPersistentEventCount() >= 1) { responseForSentVector2.Invoke(gameEvent.sentVector2); } // Vector3 if (responseForSentVector3.GetPersistentEventCount() >= 1) { responseForSentVector3.Invoke(gameEvent.sentVector3); } // GameObject if (responseWithGameObject.GetPersistentEventCount() >= 1) { responseWithGameObject.Invoke(gameEvent.sentGameObject); } // AttackEvent if (responseWithAttackEvent.GetPersistentEventCount() >= 1) { responseWithAttackEvent.Invoke(gameEvent.sentAttackEvent); } }
public virtual void Played() { Debug.Log("play " + gameObject.name); if (played.GetPersistentEventCount() > 0) { //trigger additional effect if there is any played.Invoke(); } AfterPlayed(); }
public void PickUp() { pickUp.Invoke(); if (pickUp.GetPersistentEventCount() == 0) { DefaultPickUp(); } parent.controller.TriggerHapticPulse(3999); }
private void Update() { if (m_CanExecuteButtons) { if (OnButtonPress.GetPersistentEventCount() > 0 && PlayerInput.Instance.Interact.Down) { OnButtonPress.Invoke(); } } }
public void OnTriggerEnter2D(Collider2D collision) { occupants.Add(collision); // First Occupant Trigger if (occupants.Count == 1 && ZoneIsOccupied.GetPersistentEventCount() != 0) { ZoneIsOccupied.Invoke(); } }
static public bool HasEvent(this UnityEvent evt) { if (evt != null && evt.GetPersistentEventCount() > 0 && !string.IsNullOrEmpty(evt.GetPersistentMethodName(0))) { return(true); } else { return(false); } }
public override void InEditorUpdate(GameObject go) { for (int i = 0; i < action.GetPersistentEventCount(); i++) { GameObject ob = action.GetPersistentTarget(i) as GameObject; if (go && ob) { Debug.DrawLine(go.transform.position, ob.transform.position, Color.green); } } }
public static bool EventContainsPersistentListener <T0, T1, T2, T3>(UnityEvent <T0, T1, T2, T3> unityEvent, UnityAction <T0, T1, T2, T3> listener) { for (int i = unityEvent.GetPersistentEventCount() - 1; i >= 0; i--) { if (unityEvent.GetPersistentMethodName(i).Equals(listener.Method.Name) && unityEvent.GetPersistentTarget(i).Equals(listener.Target)) { return(true); } } return(false); }
public override void Cleared() { Score.Points += bonusPoints; Timer.timeRemaining += bonusTime; BonusDisplay.ShowBonus(ScoreTypes.ClearedArea, "Cleared " + areaName, bonusPoints); if (OnComplete.GetPersistentEventCount() > 0) { OnComplete.Invoke(); } Notifications.SendNotification(notif); }
void ShowAllMethodsOfEvent <T>(UnityEvent <T> e) { var color = GUI.color; for (var i = 0; i < e.GetPersistentEventCount(); i++) { GUI.color = i % 2 == 0 ? Color.cyan : Color.yellow; GUILayout.Label(e.GetPersistentTarget(i).ToString() + "\n." + e.GetPersistentMethodName(i)); } GUI.color = color; }
private void OnClick() { if (Execute.GetPersistentEventCount() > 0) { Execute.Invoke(); } else { UIManager.Instance.OnBack(); } }
public static bool EventHasTarget(UnityEvent e) { for (int i = 0; i < e.GetPersistentEventCount(); i++) { if (e.GetPersistentTarget(i) != null) { return(true); } } return(false); }
public static void UnityEventField(UnityEvent unityEvent, SerializedProperty serializedEvent) { var lastRect = GUILayoutUtility.GetLastRect(); lastRect.y += 20; EditorGUI.PropertyField(lastRect, serializedEvent, true); GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.Height(90 + Mathf.Max(0, unityEvent.GetPersistentEventCount() - 1) * 42.5f)); }
public void CloseRadioMessage() { IsTrue = false; DuiHuaKuang.SetActive(false); timecount = 0; if (nextMessage.GetPersistentEventCount() != 0) { nextMessage.Invoke(); } AudioController.Instance.TryPlayAudio(AudioType.标点击对话); }
void Die() { if (onDeath.GetPersistentEventCount() > 0) { onDeath.Invoke(); } else { gameObject.SetActive(false); } }
public void PrintButtonListeners() { UnityEvent buttonEvent = button.onClick; int totalRegisteredEvents = buttonEvent.GetPersistentEventCount(); for (int i = 0; i < totalRegisteredEvents; ++i) { Debug.Log("Component: " + buttonEvent.GetPersistentTarget(i)); Debug.Log("Method Name: " + buttonEvent.GetPersistentMethodName(i)); } }
public static void CopyEventData(UnityEvent source, UnityEvent target) { int listeners = source.GetPersistentEventCount(); for (int i = 0; i < listeners; i++) { System.Reflection.MethodInfo info = UnityEventBase.GetValidMethodInfo(source.GetPersistentTarget(i), source.GetPersistentMethodName(i), new Type[] { typeof(float) }); UnityAction execute = () => info.Invoke(source.GetPersistentTarget(i), new object[] { 180f }); target.AddListener(execute); } }
static bool HasCall <T>(this UnityEvent <T> @event, UnityEngine.Object caller, string methodName) { for (int i = 0; i < @event.GetPersistentEventCount(); i++) { if (@event.GetPersistentTarget(i) == caller && @event.GetPersistentMethodName(i) == methodName) { return(true); } } return(false); }
protected static void AddEvent(UnityEvent <T> unityEvent, ref int index, UnityAction <T> unityAction) { if (index == -1) { UnityEventTools.AddPersistentListener(unityEvent, unityAction); index = unityEvent.GetPersistentEventCount() - 1; } else { UnityEventTools.RegisterPersistentListener(unityEvent, index, unityAction); } }
private void OnDrawGizmos() { if (debugOn) { Vector2 thisPos = transform.position; for (int i = 0; i < OnPressed.GetPersistentEventCount(); i++) { GameObject targetObject = OnPressed.GetPersistentTarget(i) as GameObject; Debug.DrawLine(thisPos, targetObject.transform.position, debugColor_link); } } }
public static bool IfNotAlready <T>(UnityEvent <T> @event, UnityEngine.Object target, UnityAction <T> action) { for (int i = 0; i < @event.GetPersistentEventCount(); ++i) { if (@event.GetPersistentTarget(i) == target && @event.GetPersistentMethodName(i) == action.Method.Name) { return(false); } } On(@event, target, action); return(true); }
/// <summary> /// Same as CheckUnityEventAction but allows to specify passing a param /// through the Event. /// </summary> public static bool CheckUnityEvent <T>(this UnityEvent <T> unityEvent) { for (int i = 0; i < unityEvent.GetPersistentEventCount(); i++) { if (unityEvent.GetPersistentTarget(i) != null) { return(true); } } return(false); }
private void UpdateResponsesCallState() { for (int i = 0; i < response.GetPersistentEventCount(); i++) { response.SetPersistentListenerState(i, enableInEditor ? UnityEventCallState.EditorAndRuntime : UnityEventCallState.RuntimeOnly); } for (int i = 0; i < responseWithData.GetPersistentEventCount(); i++) { responseWithData.SetPersistentListenerState(i, enableInEditor ? UnityEventCallState.EditorAndRuntime : UnityEventCallState.RuntimeOnly); } }
public static void AddPersistentListener <T0, T1, T2, T3>(this UnityEvent <T0, T1, T2, T3> e, UnityAction <T0, T1, T2, T3> action) { object persistentCallsObject = null; if (!UnityEventReflection.TryAccessPersistentCalls(e, ref persistentCallsObject)) { return; } int index = e.GetPersistentEventCount(); UnityEventReflection.AddPersistentListner(persistentCallsObject, index, action.Target as UnityEngine.Object, action.Method); }