27 lines
715 B
GDScript
27 lines
715 B
GDScript
extends Control
|
|
|
|
@export var marker : PackedScene
|
|
|
|
@onready var ship: PlayerShip = $"../.."
|
|
|
|
var markers = []
|
|
|
|
#func _process(_delta):
|
|
# $Sprite.self_modulate = ship.material.get_shader_parameter('color')
|
|
|
|
func _ready():
|
|
get_tree().create_timer(0.05).timeout.connect(init_markers)
|
|
|
|
func init_markers():
|
|
for ship in ship.star_system.ships:
|
|
add_marker(ship, MinimapMarker.Type.Ship)
|
|
for base in ship.star_system.bases:
|
|
add_marker(base, MinimapMarker.Type.Base)
|
|
|
|
func add_marker(target : Node, type : MinimapMarker.Type):
|
|
var marker_inst = marker.instantiate()
|
|
markers.append(marker_inst)
|
|
marker_inst.target = target
|
|
marker_inst.type = type
|
|
marker_inst.position = Vector2(120, 120)
|
|
add_child(marker_inst)
|