@tool
extends Node2D
class_name Mask

@export var mask_resource: MaskResource:
	set(new_resource):
		mask_resource = new_resource
		_on_mask_resource_changed()
		
@onready var mask_sprite: Sprite2D = $MaskSprite


func _on_mask_resource_changed() -> void:
	if mask_resource == null:
		return
	if mask_sprite != null:
		mask_sprite.texture = mask_resource.mask_sprite
	
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	if Engine.is_editor_hint():
		_engine_process(delta)
	else:
		_game_process(delta)
		
		
func _game_process(delta: float) -> void:
	pass		


func _engine_process(delta: float) -> void:
	if mask_resource == null:
		return
		
