52 lines
1.1 KiB
GDScript
52 lines
1.1 KiB
GDScript
extends Control
|
|
|
|
class_name CastIndicator
|
|
|
|
@onready var data = get_node("/root/Root/Data")
|
|
|
|
@onready var primaryBox = $border
|
|
@onready var secondaryBox = $border2
|
|
|
|
@onready var primary = $border/TextureRect
|
|
@onready var secondary = $border2/TextureRect2
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
if data.difficulty > 1:
|
|
secondaryBox.hide()
|
|
if data.difficulty > 2:
|
|
primaryBox.hide()
|
|
|
|
func setDirs(current: String, next: String = "none") -> void:
|
|
match current:
|
|
"none":
|
|
primary.hide()
|
|
"up":
|
|
primary.show()
|
|
primary.rotation_degrees = 0
|
|
"down":
|
|
primary.show()
|
|
primary.rotation_degrees = 180
|
|
"left":
|
|
primary.show()
|
|
primary.rotation_degrees = 270
|
|
"right":
|
|
primary.show()
|
|
primary.rotation_degrees = 90
|
|
|
|
match next:
|
|
"none":
|
|
secondary.hide()
|
|
"up":
|
|
secondary.show()
|
|
secondary.rotation_degrees = 0
|
|
"down":
|
|
secondary.show()
|
|
secondary.rotation_degrees = 180
|
|
"left":
|
|
secondary.show()
|
|
secondary.rotation_degrees = 270
|
|
"right":
|
|
secondary.show()
|
|
secondary.rotation_degrees = 90
|