Add Shop spawn station
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class_name GameManager
|
||||
extends Node
|
||||
|
||||
static var money: int = 35
|
||||
static var money: int = 100
|
||||
static var meals_in_play: Array[String]
|
||||
static var sides_in_play: Array[String]
|
||||
|
||||
|
||||
+2
-1
@@ -2,4 +2,5 @@ extends Node
|
||||
|
||||
signal game_over
|
||||
signal restart_game
|
||||
signal game_state_changed(new_state: GameManager.GameState)
|
||||
signal game_state_changed(new_state: GameManager.GameState)
|
||||
signal station_bought(instance: Node3D)
|
||||
|
||||
+16
-1
@@ -1,5 +1,8 @@
|
||||
class_name Helper
|
||||
|
||||
const SNAP_GRID_SIZE = 0.6
|
||||
|
||||
|
||||
# Find a FoodItem among the direct children of [param node].
|
||||
static func find_food_item(node: Node) -> FoodItem:
|
||||
if not node:
|
||||
@@ -9,6 +12,7 @@ static func find_food_item(node: Node) -> FoodItem:
|
||||
return child
|
||||
return null
|
||||
|
||||
|
||||
static func find_first_child_of_type(node: Node, type: Variant) -> Node:
|
||||
for child in node.get_children():
|
||||
if is_instance_of(child, type):
|
||||
@@ -16,4 +20,15 @@ static func find_first_child_of_type(node: Node, type: Variant) -> Node:
|
||||
var nested := find_first_child_of_type(child, type)
|
||||
if nested:
|
||||
return nested
|
||||
return null
|
||||
return null
|
||||
|
||||
|
||||
# Returns a transform with position snapped to the 0.6 grid and rotation snapped to 90 degrees.
|
||||
static func get_snapped_transform(node: Node3D) -> Transform3D:
|
||||
var new_transform: Transform3D
|
||||
new_transform.origin.x = snappedf(node.global_position.x, SNAP_GRID_SIZE)
|
||||
new_transform.origin.z = snappedf(node.global_position.z, SNAP_GRID_SIZE)
|
||||
new_transform.origin.y = node.global_position.y
|
||||
var target_yaw: float = snappedf(node.global_rotation_degrees.y, 90)
|
||||
new_transform.basis = Basis(Vector3.UP, deg_to_rad(target_yaw))
|
||||
return new_transform
|
||||
|
||||
Reference in New Issue
Block a user