public void Impact(GameObject gameObject) { if (gizmoidHolder.gizmoids.Count == 0) { AudioPlayer.Instance.PlaySoundClip(clipDestroy, transform); onImpact.Invoke(this, gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { if (targetTags.Contains(collision.gameObject.tag)) { var health = collision.GetComponent <Health>(); if (!health) { health = collision.GetComponentInParent <Health>(); } if (health) { Impact(health); } var impact = collision.GetComponent <IImpactable>(); if (impact != null) { impact.Impact(collision.gameObject); } onImpact.Invoke(collision.gameObject); gameObject.SetActive(false); } }
public void Impact(GameObject gameObject) { onImpact.Invoke(gameObject.transform); }