private void OnTriggerEnter(Collider collision) { var category = collision.gameObject.GetComponent <Enemy>(); if (category is Enemy) { var enemy = category as Enemy; EnemyReachDestinationEvent?.Invoke(enemy); EnemyDiscardEvent?.Invoke(enemy, this); Destroy(enemy.gameObject); } }
protected void ReachDestination() { ReachDestinationEvent?.Invoke(this); EnemyDiscardEvent?.Invoke(this); Destroy(gameObject); }