feat(snap-points): add SnapPoints to all EG rooms (Reception, GiftShop, Restaurant, EmergencyRoom)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cozypaw_emergency"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cozypaw_emergency"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://scenes/objects/InteractiveObject.tscn" id="1_iobj"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/objects/Ambulance.tscn" id="2_ambulance"]
|
||||
[ext_resource type="Script" path="res://scripts/objects/snap_point.gd" id="3_snap"]
|
||||
|
||||
[node name="EmergencyRoom" type="Node2D"]
|
||||
|
||||
@@ -73,3 +74,8 @@ position = Vector2(550, 440)
|
||||
position = Vector2(500, 570)
|
||||
trigger_floor = 0
|
||||
trigger_room = 3
|
||||
|
||||
[node name="SnapMedicalTable" type="Node2D" parent="."]
|
||||
position = Vector2(310, 480)
|
||||
script = ExtResource("3_snap")
|
||||
pose = "lying"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cozypaw_giftshop"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cozypaw_giftshop"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://scenes/objects/InteractiveObject.tscn" id="1_iobj"]
|
||||
[ext_resource type="Script" path="res://scripts/objects/snap_point.gd" id="2_snap"]
|
||||
|
||||
[node name="GiftShop" type="Node2D"]
|
||||
|
||||
@@ -63,3 +64,7 @@ position = Vector2(900, 330)
|
||||
|
||||
[node name="GiftBox" parent="." instance=ExtResource("1_iobj")]
|
||||
position = Vector2(640, 510)
|
||||
|
||||
[node name="SnapCounter" type="Node2D" parent="."]
|
||||
position = Vector2(640, 528)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cozypaw_reception"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cozypaw_reception"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://scenes/objects/InteractiveObject.tscn" id="1_iobj"]
|
||||
[ext_resource type="Script" path="res://scripts/objects/snap_point.gd" id="2_snap"]
|
||||
|
||||
[node name="Reception" type="Node2D"]
|
||||
|
||||
@@ -85,3 +86,19 @@ position = Vector2(530, 510)
|
||||
|
||||
[node name="PottedPlant" parent="." instance=ExtResource("1_iobj")]
|
||||
position = Vector2(1180, 560)
|
||||
|
||||
[node name="SnapBenchLeft1" type="Node2D" parent="."]
|
||||
position = Vector2(150, 555)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
[node name="SnapBenchLeft2" type="Node2D" parent="."]
|
||||
position = Vector2(240, 555)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
[node name="SnapBenchRight1" type="Node2D" parent="."]
|
||||
position = Vector2(990, 555)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
[node name="SnapBenchRight2" type="Node2D" parent="."]
|
||||
position = Vector2(1080, 555)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cozypaw_restaurant"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cozypaw_restaurant"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://scenes/objects/InteractiveObject.tscn" id="1_iobj"]
|
||||
[ext_resource type="Script" path="res://scripts/objects/snap_point.gd" id="2_snap"]
|
||||
|
||||
[node name="Restaurant" type="Node2D"]
|
||||
|
||||
@@ -93,3 +94,27 @@ position = Vector2(1060, 490)
|
||||
|
||||
[node name="CashRegister" parent="." instance=ExtResource("1_iobj")]
|
||||
position = Vector2(640, 210)
|
||||
|
||||
[node name="SnapTable1Left" type="Node2D" parent="."]
|
||||
position = Vector2(160, 510)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
[node name="SnapTable1Right" type="Node2D" parent="."]
|
||||
position = Vector2(280, 510)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
[node name="SnapTable2Left" type="Node2D" parent="."]
|
||||
position = Vector2(580, 510)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
[node name="SnapTable2Right" type="Node2D" parent="."]
|
||||
position = Vector2(700, 510)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
[node name="SnapTable3Left" type="Node2D" parent="."]
|
||||
position = Vector2(1000, 510)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
[node name="SnapTable3Right" type="Node2D" parent="."]
|
||||
position = Vector2(1120, 510)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
## Tests verifying SnapPoints exist in all EG (Erdgeschoss) room scenes.
|
||||
extends GutTest
|
||||
|
||||
|
||||
func _count_snaps(room: Node2D) -> int:
|
||||
var count: int = 0
|
||||
for child: Node in room.get_children():
|
||||
if child is SnapPoint:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
func _count_snaps_with_pose(room: Node2D, pose: String) -> int:
|
||||
var count: int = 0
|
||||
for child: Node in room.get_children():
|
||||
var snap: SnapPoint = child as SnapPoint
|
||||
if snap != null and snap.pose == pose:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
func test_reception_has_four_snap_points() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/Reception.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 4)
|
||||
|
||||
|
||||
func test_reception_all_snaps_are_sitting() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/Reception.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "sitting"), 4)
|
||||
|
||||
|
||||
func test_giftshop_has_one_snap_point() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/GiftShop.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 1)
|
||||
|
||||
|
||||
func test_giftshop_snap_is_sitting() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/GiftShop.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "sitting"), 1)
|
||||
|
||||
|
||||
func test_restaurant_has_six_snap_points() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/Restaurant.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 6)
|
||||
|
||||
|
||||
func test_restaurant_all_snaps_are_sitting() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/Restaurant.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "sitting"), 6)
|
||||
|
||||
|
||||
func test_emergency_room_has_one_snap_point() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/EmergencyRoom.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 1)
|
||||
|
||||
|
||||
func test_emergency_room_snap_is_lying() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor0/EmergencyRoom.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "lying"), 1)
|
||||
Reference in New Issue
Block a user