update buildmanager

This commit is contained in:
Nikolai Fesenko
2025-08-15 22:30:48 +02:00
parent 5c71f036af
commit 888ef9d1d9
9 changed files with 62 additions and 10 deletions

View File

@@ -3,14 +3,18 @@ extends Node
@onready var DoubleBeds = preload("res://Scenes/Prefabs/DoubleBeds.tscn")
@onready var Pot = preload("res://Scenes/Prefabs/Pot.tscn")
var selected_object_id: int
signal build_object_selected
var selected_object_id: int
var is_object_selected: bool
var global_y = 2.903
func _ready() -> void:
print(DoubleBeds)
is_object_selected = false
build_object_selected.connect(_on_object_selected)
func get_preview_object():
var selected_object
@@ -20,3 +24,7 @@ func get_preview_object():
1:
selected_object = Pot
return selected_object
func _on_object_selected():
is_object_selected = true

View File

@@ -23,7 +23,7 @@ func _input_event(camera: Camera3D, event: InputEvent, event_position: Vector3,
func _mouse_enter() -> void:
if !is_placed and Global.build_mode:
if !is_placed and Global.build_mode and BuildManager.is_object_selected:
show_preview()
func _mouse_exit() -> void:

View File

@@ -3,8 +3,12 @@ extends Button
@export var id: int
func _ready() -> void:
pass
func _on_pressed() -> void:
BuildManager.selected_object_id = id
BuildManager.build_object_selected.emit()
print(BuildManager.selected_object_id)