extends CanvasLayer

@onready var color_rect: ColorRect = $ColorRect

func _ready() -> void:
  pass # Replace with function body.

func _process(delta: float) -> void:
  var ec: CharacterBody3D = $"/root/Main/LevelManager/Level/NPC/NPC_Tawna"
  if ec:
    color_rect.visible = not get_viewport().get_camera_3d().is_position_behind(ec.global_transform.origin + Vector3(0, 0.8, 0))
    var x: Vector2 = get_viewport().get_camera_3d().unproject_position(ec.global_transform.origin + Vector3(0, 0.8, 0))
    color_rect.position = x +- Vector2(0, 30)
