28 lines
695 B
GDScript
28 lines
695 B
GDScript
@tool
|
|
class_name PlayerSpawnPoint
|
|
extends Marker3D
|
|
|
|
@export var spawn_index: int = 0: set = set_spawn_index
|
|
|
|
var idx_label: Label3D
|
|
|
|
|
|
func _init() -> void:
|
|
if Engine.is_editor_hint():
|
|
add_child(load("res://components/characters/player/player_character.tscn").instantiate(), false, Node.INTERNAL_MODE_FRONT)
|
|
|
|
# Setup label.
|
|
idx_label = Label3D.new()
|
|
idx_label.billboard = BaseMaterial3D.BILLBOARD_ENABLED
|
|
idx_label.shaded = false
|
|
add_child(idx_label, false, Node.INTERNAL_MODE_FRONT)
|
|
idx_label.position.y = 1.8
|
|
set_spawn_index(spawn_index)
|
|
|
|
|
|
func set_spawn_index(index: int) -> void:
|
|
spawn_index = index
|
|
|
|
if is_instance_valid(idx_label):
|
|
idx_label.text = str(spawn_index)
|