/// <summary> /// Actualiza su estado dependiendo de si ha visto al jugador o está cerca de él /// </summary> public override void Sight(RaycastHit2D sight) { base.Sight(sight); laserHitPos = sight.point; if (playerDetected) { if (Vector2.Distance(player.transform.position, transform.position) < minDistance) { state = EnemyState.Fleeing; followDirection.Stop(); lr.enabled = false; shooting.ResetCooldown(); } else { state = EnemyState.Shooting; lr.enabled = playerDetected; followDirection.Stop(); } } else { state = EnemyState.Idle; followDirection.Stop(); lr.enabled = false; } }