moved all build related code rom global to buildmanger
This commit is contained in:
@@ -11,22 +11,22 @@ var is_placed = false
|
||||
func _ready() -> void:
|
||||
areas = get_children()
|
||||
buildTransparentPreivew.visible = false
|
||||
Global.exit_build_mode.connect(_on_exit_build_mode)
|
||||
Global.enter_build_mode.connect(_on_enter_build_mode)
|
||||
BuildManager.exit_build_mode.connect(_on_exit_build_mode)
|
||||
BuildManager.enter_build_mode.connect(_on_enter_build_mode)
|
||||
|
||||
|
||||
func _input_event(camera: Camera3D, event: InputEvent, event_position: Vector3, normal: Vector3, shape_idx: int) -> void:
|
||||
if event.is_action_pressed("mouse_click") and Global.build_mode:
|
||||
if event.is_action_pressed("mouse_click") and BuildManager.build_mode:
|
||||
place_object()
|
||||
|
||||
|
||||
|
||||
func _mouse_enter() -> void:
|
||||
if !is_placed and Global.build_mode and BuildManager.is_object_selected:
|
||||
if !is_placed and BuildManager.build_mode and BuildManager.is_object_selected:
|
||||
show_preview()
|
||||
|
||||
func _mouse_exit() -> void:
|
||||
if !is_placed and Global.build_mode:
|
||||
if !is_placed and BuildManager.build_mode:
|
||||
hide_preview()
|
||||
|
||||
func show_preview():
|
||||
@@ -36,7 +36,7 @@ func show_preview():
|
||||
areas[0].add_child(previewObject)
|
||||
#previewObject.global_position.y = BuildManager.global_y
|
||||
buildTransparentPreivew.visible = false
|
||||
Global.preview_created.emit()
|
||||
BuildManager.preview_created.emit()
|
||||
|
||||
func hide_preview():
|
||||
if is_placed != true:
|
||||
@@ -47,7 +47,7 @@ func hide_preview():
|
||||
func place_object():
|
||||
#is_placed = true
|
||||
#buildTransparentPreivew.visible = false
|
||||
Global.object_placed.emit(self.position)
|
||||
BuildManager.object_placed.emit(self.position)
|
||||
self.queue_free()
|
||||
|
||||
func _on_enter_build_mode():
|
||||
|
||||
Reference in New Issue
Block a user