Fix gamemanager state syncing
This commit is contained in:
@@ -22,7 +22,8 @@ func _on_button_pressed() -> void:
|
||||
|
||||
|
||||
func _buy_station() -> void:
|
||||
GameManager.money -= cost
|
||||
print("ShopStationButton _buy_station:, ", "cost=", cost, " current money=", GameManager.money)
|
||||
GameManager.set_money(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()
|
||||
transform.origin += (forward * 0.6)
|
||||
@@ -33,7 +34,7 @@ func _buy_station() -> void:
|
||||
|
||||
Signals.station_bought.emit(instance)
|
||||
|
||||
@rpc("reliable")
|
||||
@rpc("any_peer", "call_remote", "reliable")
|
||||
func _ask_server_to_spawn(station_scene_path, transform):
|
||||
NetworkManager.spawn_item(station_scene_path, transform)
|
||||
|
||||
|
||||
+5
-1
@@ -34,6 +34,8 @@ func toggle_shop():
|
||||
if GameManager.game_state == GameManager.GameState.BUILDING:
|
||||
print("Shop UI toggle shop")
|
||||
enabled = !enabled
|
||||
print ("Shop UI _process: money=", GameManager.money, " label text=", money_label.text)
|
||||
|
||||
|
||||
|
||||
func _set_enabled(value: bool) -> void:
|
||||
@@ -77,7 +79,9 @@ func _on_other_controller_button_pressed(button_name: String) -> void:
|
||||
|
||||
func _on_station_bought(_instance) -> void:
|
||||
enabled = false
|
||||
|
||||
money_label.text = str(GameManager.money) + "$"
|
||||
print("Shop UI _on_station_bought: new money: ", GameManager.money)
|
||||
|
||||
|
||||
func detect_hand_from_xr_ancestor() -> void:
|
||||
controller = XRHelpers.get_xr_controller(self)
|
||||
|
||||
Reference in New Issue
Block a user