aboutsummaryrefslogtreecommitdiff
path: root/game/src/SampleGame.gd
blob: 589fed202e265ce5b222a80c5711adb824bc134d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
extends Control

var selectedId = 0

@export
var _province_num_display : Label

@export
var _province_size_display : Label

@export
var _main_menu_scene : PackedScene

# Called when the node enters the scene tree for the first time.
func _ready():
   updateVisibleInfo()
   pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#  pass


func updateVisibleInfo():
   _province_num_display.text = str(selectedId)
   _province_size_display.text = str(Simulation.queryProvinceSize(selectedId))


func _on_pass_time_button_pressed():
   Simulation.conductSimulationStep()
   updateVisibleInfo()


func _on_next_prov_button_pressed():
   selectedId = (selectedId + 1) % 10
   updateVisibleInfo()


func _on_prev_prov_button_pressed():
   if selectedId == 0:
      selectedId = 9
   else:
      selectedId -= 1
   updateVisibleInfo()


func _on_to_main_menu_pressed():
   get_tree().change_scene_to_packed(_main_menu_scene)