public void Invoke() { if (_event != null) { _event.Invoke(); } }
// NOT called when SetValueSilent is called protected virtual void OnChanged(T oldValue, T newValue) { if (valueChanged != null) { valueChanged.Invoke(newValue); } }
void Update() { while (Interval > 0 && Time.time >= nextTime) { fire.Invoke(); nextTime += Interval; } }
void Update() { if (Input.GetButtonDown(Button) && down != null) { down.Invoke(); } if (Input.GetButtonUp(Button) && up != null) { up.Invoke(); } }
public void Test() { if (Value && True != null) { True.Invoke(); } else if (!Value && False != null) { False.Invoke(); } }
void Update() { if (Input.GetKeyDown(Key) && down != null) { down.Invoke(); } if (Input.GetKeyUp(Key) && up != null) { up.Invoke(); } }
public bool CheckCorrectItem(BasicItem item) { if (item?.Kind != RequiredItem) { OnWrongItem.Invoke(); return(false); } else { OnToggle.Invoke(); return(true); } }
public void Test(GameObject gameObject) { bool match = Matches(gameObject); if (match && pass != null) { pass.Invoke(gameObject); } else if (!match && fail != null) { fail.Invoke(gameObject); } }
public bool Raycast() { bool raycastHit = Physics.Raycast(transform.position, transform.forward, out RaycastHit hitInfo, MaxDistance, Mask, triggerInteraction); if (raycastHit && hit != null) { hit.Invoke(hitInfo.transform); // uses rigidbody if available } else if (!raycastHit && miss != null) { miss.Invoke(); } return(raycastHit); }
private void CollisionEnter(Collider c) { if (!enabled) { return; } GameObject o = c.gameObject; if (ColliderMatches(c) && touching.Add(o)) { if (startTouch != null) { startTouch.Invoke(o); } if (touching.Count == 1 && startTouchAll != null) { startTouchAll.Invoke(o); } } }
private void StateChange(CounterState oldState, CounterState newState) { if (newState.atMin && !oldState.atMin && hitMin != null) { hitMin.Invoke(); } else if (!newState.atMin && oldState.atMin && changedFromMin != null) { changedFromMin.Invoke(); } if (newState.atMax && !oldState.atMax && hitMax != null) { hitMax.Invoke(); } else if (!newState.atMax && oldState.atMax && changedFromMax != null) { changedFromMax.Invoke(); } }
void Update() { bool isPlaying; if (AnimationName == null || AnimationName == "") { isPlaying = animation.isPlaying; } else { isPlaying = animation.IsPlaying(AnimationName); } if (isPlaying && !wasPlaying) { start.Invoke(); } if (!isPlaying && wasPlaying) { complete.Invoke(); } wasPlaying = isPlaying; }
/// <summary>Invokes <see cref="_disableEvent"/>.</summary> public virtual void OnDisable() { _disableEvent?.Invoke(); }
/// <summary>Invokes <see cref="_enableEvent"/>.</summary> public virtual void OnEnable() { _enableEvent?.Invoke(); }