Prepared Movement behaviour. Fixed multi-tile placement bug
This commit is contained in:
parent
62eef907d3
commit
397082f966
17 changed files with 395 additions and 75 deletions
|
|
@ -2,11 +2,21 @@ extends Control
|
|||
|
||||
const IN_GAME_MENU = preload("res://UI/InGameMenu/InGameMenu.tscn")
|
||||
const RULES = preload("res://UI/Rules/Rules.tscn")
|
||||
|
||||
@onready var surrender_button = $VBoxContainer/SurrenderButton
|
||||
@onready var pass_round_button = $VBoxContainer/PassRoundButton
|
||||
|
||||
var is_blacks_turn: bool = false
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
GameEvents.turn_started.connect(_on_turn_started)
|
||||
|
||||
func _on_turn_started(round_num: int, map: HexGrid, _is_blacks_turn: bool) -> void:
|
||||
is_blacks_turn = _is_blacks_turn
|
||||
surrender_button.disabled = GameData.is_player_black != _is_blacks_turn and not GameData.is_hot_seat
|
||||
pass_round_button.disabled = GameData.is_player_black != _is_blacks_turn and not GameData.is_hot_seat
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
|
@ -25,3 +35,16 @@ func _on_menu_button_pressed():
|
|||
get_tree().root.add_child(in_game_menu)
|
||||
|
||||
in_game_menu.show_panel()
|
||||
|
||||
@rpc("any_peer", "call_local")
|
||||
func surrender() -> void:
|
||||
if is_blacks_turn:
|
||||
GameEvents.game_over.emit(true, false)
|
||||
else:
|
||||
GameEvents.game_over.emit(false, true)
|
||||
|
||||
func _on_surrender_button_pressed():
|
||||
surrender.rpc()
|
||||
|
||||
func _on_pass_round_button_pressed():
|
||||
GameEvents.pass_round.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue