private void OnMouseDown() { if (OnEnemyClicked != null) { OnEnemyClicked.Invoke(this); } }
void MouseControl() { if (Input.GetMouseButtonDown(0) && hitInfo.collider != null) { if (hitInfo.collider.gameObject.CompareTag("Ground")) { OnMouseClicked?.Invoke(hitInfo.point); } if (hitInfo.collider.gameObject.CompareTag("Enemy")) { OnEnemyClicked?.Invoke(hitInfo.collider.gameObject); } if (hitInfo.collider.gameObject.CompareTag("Attackable")) { OnEnemyClicked?.Invoke(hitInfo.collider.gameObject); } if (hitInfo.collider.gameObject.CompareTag("Portal")) { OnMouseClicked?.Invoke(hitInfo.point); } if (hitInfo.collider.gameObject.CompareTag("Item")) { OnMouseClicked?.Invoke(hitInfo.point); } } }