build preview update
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
extends StaticBody3D
|
||||
|
||||
|
||||
|
||||
@onready var beds = preload("res://Scenes/Prefabs/DoubleBeds.tscn")
|
||||
@export var buildTransparentPreivew: MeshInstance3D
|
||||
|
||||
|
||||
var areas
|
||||
var previewObject: Node3D
|
||||
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)
|
||||
|
||||
|
||||
func _input_event(camera: Camera3D, event: InputEvent, event_position: Vector3, normal: Vector3, shape_idx: int) -> void:
|
||||
@@ -27,15 +33,26 @@ func _mouse_exit() -> void:
|
||||
func show_preview():
|
||||
previewObject = beds.instantiate()
|
||||
areas[0].add_child(previewObject)
|
||||
buildTransparentPreivew.visible = false
|
||||
Global.preview_created.emit()
|
||||
|
||||
func hide_preview():
|
||||
if is_placed != true:
|
||||
if previewObject != null:
|
||||
previewObject.queue_free()
|
||||
buildTransparentPreivew.visible = true
|
||||
|
||||
func place_object():
|
||||
is_placed = true
|
||||
buildTransparentPreivew.visible = false
|
||||
|
||||
|
||||
func _on_enter_build_mode():
|
||||
if !is_placed:
|
||||
buildTransparentPreivew.visible = true
|
||||
func _on_exit_build_mode():
|
||||
hide_preview()
|
||||
buildTransparentPreivew.visible = false
|
||||
|
||||
func set_preview_material():
|
||||
#beds
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user