void OnCollisionEnter(Collision collision) { if (!collision.gameObject.CompareTag(collisionTag) || Time.time - lastBiteTime < delayBetweenBites) { return; } Consumed?.Invoke(); // Show the new mesh and play a sound. if (sfx) { AudioSource.PlayClipAtPoint(sfx, transform.position, volume); } if (destroy) { Destroy(destroy); if (activate) { activate.SetActive(true); } } else { if (destroyInTheEnd) { Destroy(gameObject); } } lastBiteTime = Time.time; }
protected virtual void OnConsumed(PawnConsumedEventArgs e) { Consumed?.Invoke(this, e); }
private void RaiseConsumed(TProduct product) { Consumed?.Invoke(this, new ConsumedEventArgs <TProduct>(product)); }
private Task OnTriggered(T item, CancellationToken cancellationToken) { return(Consumed?.Invoke(this, new ProducerConsumerConsumedHandlerArgs <T>(item), cancellationToken) ?? Task.CompletedTask); }