private void OnTriggerEnter(Collider other) { Icollectable icollectable = other.GetComponent <Icollectable>(); if (icollectable != null) { icollectable.Collect(); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Collectable")) { Icollectable collectable = other.gameObject.GetComponent <Icollectable>(); coins.Value += collectable.ScoreValue; collectable.HideTheCollectable(); onHitCollectable.Raise(); } }