Add Shop spawn station
This commit is contained in:
@@ -19,6 +19,16 @@ func _ready() -> void:
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
print("ShopStationButton buy ", station_name)
|
||||
_buy_station()
|
||||
|
||||
func _buy_station() -> void:
|
||||
GameManager.money -= cost
|
||||
var transform = Helper.get_snapped_transform(XRHelpers.get_xr_origin(self).get_node_or_null("PlayerBody"))
|
||||
var forward: Vector3 = -transform.basis.z.normalized()
|
||||
# TODO: Don't move up. Fix scenes.
|
||||
transform.origin += (forward * 0.6) + Vector3(0, 0.5, 0)
|
||||
var instance = NetworkManager.spawn_item(station_scene.resource_path, transform)
|
||||
Signals.station_bought.emit(instance)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
button.disabled = GameManager.money < cost
|
||||
|
||||
Reference in New Issue
Block a user