private void OnCollisionEnter(Collision collision) { Hitter hitter = collision.transform.gameObject.GetComponent <Hitter>(); if (hitter != null) { OnHitterEnter?.Invoke(hitter); } }
void OnParticleCollision(GameObject other) { Hitter hitter = other.GetComponent <Hitter>(); if (hitter != null) { OnHitterEnter?.Invoke(hitter); } }
private void OnTriggerEnter(Collider other) { Hitter hitter = other.transform.gameObject.GetComponent <Hitter>(); if (hitter != null && hitter.gameObject.activeInHierarchy) { OnHitterEnter?.Invoke(hitter); if (hitter.GetType() == typeof(ActivatableHitter)) { ActivatableHitter activatableHitter = (ActivatableHitter)hitter; if (activatableHitter.IsActive) { onHitterActivated(activatableHitter, activatableHitter.LastParameters); } else if (!registeredHitters.Contains(activatableHitter)) { activatableHitter.OnActivate += onHitterActivated; registeredHitters.Add(activatableHitter); } } } }