private void DecideBehavior() { // Debug.Log(diverRef.IsHiding()); if (isPlayerSpotted) { if (diverRef.IsHiding()) { isPlayerSpotted = false; lastSeenPosition = diverRef.GetLastHidingPosition(); sharkState = SharkState.INVESTIGATING; } else { sharkState = SharkState.ATTACKING; } } else { if (sharkState == SharkState.ATTACKING) { sharkState = SharkState.INVESTIGATING; } if (sharkState == SharkState.INVESTIGATING) { if (Vector3.Distance(transform.position, lastSeenPosition) <= Mathf.Epsilon) { sharkState = SharkState.PATROLLING; } } } }