-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep_state.gd
34 lines (26 loc) · 1006 Bytes
/
step_state.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
extends Node
var state_set: bool = false
# State for the goal areas of the objects placed in this step
var goals_for_manip_objects: Array[Vector3] = []
# State for the goal interactions of the objects placed in this step
# TODO Need to come up with the structure of this state
func _origin_within_bounds(test: Vector3, goal: Vector3) -> bool:
for i in range(3):
if test.x < goal.x - 0.5 or test.x > goal.x + 0.5:
return false
if test.y < goal.y - 0.5 or test.y > goal.y + 0.5:
return false
if test.z < goal.z - 0.5 or test.z > goal.z + 0.5:
return false
return true
func manip_object_goals_achieved(manip_objects: Array[Block]) -> bool:
if manip_objects.size() != goals_for_manip_objects.size():
return false
for object in manip_objects:
var matched_transform: bool = false
for goal_origin in goals_for_manip_objects:
if _origin_within_bounds(object.transform.origin, goal_origin):
matched_transform = true
if not matched_transform:
return false
return true