30 lines
1 KiB
GDScript3
30 lines
1 KiB
GDScript3
|
|
extends Control
|
||
|
|
|
||
|
|
const HEX_BLACK = preload("res://UI/hex_black.svg")
|
||
|
|
const HEX_WHITE = preload("res://UI/hex_white.svg")
|
||
|
|
|
||
|
|
@onready var texture_rect: TextureRect = $TextureRect
|
||
|
|
|
||
|
|
# Called when the node enters the scene tree for the first time.
|
||
|
|
func _ready():
|
||
|
|
GameEvents.turn_started.connect(_on_turn_started)
|
||
|
|
pass # Replace with function body.
|
||
|
|
|
||
|
|
func _on_turn_started(turn_num: int, map: HexGrid, is_blacks_turn: bool) -> void:
|
||
|
|
print("turn started")
|
||
|
|
print(multiplayer.is_server())
|
||
|
|
|
||
|
|
var new_texture = HEX_WHITE
|
||
|
|
if is_blacks_turn:
|
||
|
|
new_texture = HEX_BLACK
|
||
|
|
|
||
|
|
var tween = get_tree().create_tween()
|
||
|
|
tween.tween_property(self, "scale", Vector2(0.0, 0.0), 0.5).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_ELASTIC)
|
||
|
|
tween.tween_property(texture_rect, "texture", new_texture, 0.0)
|
||
|
|
tween.tween_property(self, "scale", Vector2(0.1, 0.1), 0.5).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_ELASTIC)
|
||
|
|
|
||
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
|
func _process(delta):
|
||
|
|
rotation += delta * PI / 12.0
|
||
|
|
pass
|