supports resources based on masks.
This commit is contained in:
13
SetPiece_.gd
13
SetPiece_.gd
@@ -10,6 +10,7 @@ extends Polygon2D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
_update_polygon_from_resource()
|
||||
self.color.a = 0.25
|
||||
if Engine.is_editor_hint():
|
||||
self.color.a = 0.25
|
||||
@@ -17,7 +18,12 @@ func _ready():
|
||||
pass
|
||||
else:
|
||||
hide()
|
||||
pass # Replace with function body.
|
||||
pass # Replace with function body
|
||||
|
||||
|
||||
func _update_polygon_from_resource() -> void:
|
||||
if points_resource and points_resource.points.size() > 0:
|
||||
polygon = points_resource.points
|
||||
|
||||
signal interacted
|
||||
signal walked
|
||||
@@ -28,6 +34,10 @@ signal entered(lab)
|
||||
signal exited
|
||||
|
||||
@export var label: String
|
||||
@export var points_resource: PolygonPointsResource:
|
||||
set(value):
|
||||
points_resource = value
|
||||
_update_polygon_from_resource()
|
||||
|
||||
var is_in = false
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@@ -38,6 +48,7 @@ func _process(delta):
|
||||
if Geometry2D.is_point_in_polygon(to_local(get_global_mouse_position()), self.polygon):
|
||||
if is_in == false:
|
||||
is_in = true
|
||||
print("ENTERED0", label)
|
||||
emit_signal("entered", label)
|
||||
else:
|
||||
if is_in == true:
|
||||
|
||||
Reference in New Issue
Block a user