private void OnTriggerEnter2D(Collider2D collision) { if (eventType == Event.Exit) { return; } if (accountForInvulnerability) { if (ivc) { if (ivc.enabled) { return; } } InvulnerabilityController otherIvc = collision.gameObject.GetComponent <InvulnerabilityController>(); if (otherIvc) { if (otherIvc.enabled) { return; } } } foreach (var s in tags) { if (s == collision.tag) { Destroy(gameObject); if (effect) { Instantiate(effect, transform.position, transform.rotation); } } } }
private void Start() { ivc = GetComponent <InvulnerabilityController>(); }