void OnTriggerEnter(Collider otherColl) { if (otherColl.gameObject.tag == "EnemyShip") { tooClose = true; playerAI.SetObstacleDetected(otherColl.gameObject); } }
void OnTriggerEnter(Collider otherColl) { if (otherColl.gameObject.tag == "obstacle") { isObstacle = true; if (transform.parent.gameObject.tag == "EnemyShip") { enemyShipAI.SetObstacleDetected(otherColl.gameObject); } if (transform.parent.gameObject.tag == "PlayerShip") { playerShipAI.SetObstacleDetected(otherColl.gameObject); } } }