Kolonizacja, populacja, surowce
System kolonizacji Przyrost populacji Wydobycie surowców
This commit is contained in:
parent
e417f8be63
commit
456ae98e0f
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 MiB After Width: | Height: | Size: 227 KiB |
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://ddq4cwf35o38q"
|
uid="uid://c77e86rim4e14"
|
||||||
path="res://.godot/imported/space1.jpg-f2b600a82fbdebed68f1c034ae0e23c4.ctex"
|
path="res://.godot/imported/space1.jpg-f2b600a82fbdebed68f1c034ae0e23c4.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
|
|||||||
BIN
assets/icons/col_icon.png
Normal file
BIN
assets/icons/col_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 592 KiB |
40
assets/icons/col_icon.png.import
Normal file
40
assets/icons/col_icon.png.import
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dn3ijd0jddbvj"
|
||||||
|
path="res://.godot/imported/col_icon.png-6c59571051309f207b492deb22af2021.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/icons/col_icon.png"
|
||||||
|
dest_files=["res://.godot/imported/col_icon.png-6c59571051309f207b492deb22af2021.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
67
export_presets.cfg
Normal file
67
export_presets.cfg
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
[preset.0]
|
||||||
|
|
||||||
|
name="SpaceEmpire"
|
||||||
|
platform="Windows Desktop"
|
||||||
|
runnable=true
|
||||||
|
advanced_options=false
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="../../GodotExe/SpaceEmpire.exe"
|
||||||
|
patches=PackedStringArray()
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
seed=0
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
script_export_mode=2
|
||||||
|
|
||||||
|
[preset.0.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
debug/export_console_wrapper=0
|
||||||
|
binary_format/embed_pck=false
|
||||||
|
texture_format/s3tc_bptc=true
|
||||||
|
texture_format/etc2_astc=false
|
||||||
|
shader_baker/enabled=false
|
||||||
|
binary_format/architecture="x86_64"
|
||||||
|
codesign/enable=false
|
||||||
|
codesign/timestamp=true
|
||||||
|
codesign/timestamp_server_url=""
|
||||||
|
codesign/digest_algorithm=1
|
||||||
|
codesign/description=""
|
||||||
|
codesign/custom_options=PackedStringArray()
|
||||||
|
application/modify_resources=true
|
||||||
|
application/icon=""
|
||||||
|
application/console_wrapper_icon=""
|
||||||
|
application/icon_interpolation=4
|
||||||
|
application/file_version=""
|
||||||
|
application/product_version=""
|
||||||
|
application/company_name=""
|
||||||
|
application/product_name=""
|
||||||
|
application/file_description=""
|
||||||
|
application/copyright=""
|
||||||
|
application/trademarks=""
|
||||||
|
application/export_angle=0
|
||||||
|
application/export_d3d12=0
|
||||||
|
application/d3d12_agility_sdk_multiarch=true
|
||||||
|
ssh_remote_deploy/enabled=false
|
||||||
|
ssh_remote_deploy/host="user@host_ip"
|
||||||
|
ssh_remote_deploy/port="22"
|
||||||
|
ssh_remote_deploy/extra_args_ssh=""
|
||||||
|
ssh_remote_deploy/extra_args_scp=""
|
||||||
|
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
|
||||||
|
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
|
||||||
|
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
|
||||||
|
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
||||||
|
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
|
||||||
|
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
|
||||||
|
Start-ScheduledTask -TaskName godot_remote_debug
|
||||||
|
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
|
||||||
|
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
|
||||||
|
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||||
|
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||||
|
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||||
@ -14,3 +14,7 @@ config/name="Space Empire"
|
|||||||
run/main_scene="uid://b1a8a10jb4auf"
|
run/main_scene="uid://b1a8a10jb4auf"
|
||||||
config/features=PackedStringArray("4.5", "Forward Plus")
|
config/features=PackedStringArray("4.5", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/mode=3
|
||||||
|
|||||||
@ -1,6 +1,14 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://b6fkb4gbx0c6n"]
|
[gd_scene load_steps=3 format=3 uid="uid://b6fkb4gbx0c6n"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://brbwisvv7p2wm" path="res://scripts/planet.gd" id="1_cktii"]
|
[ext_resource type="Script" uid="uid://brbwisvv7p2wm" path="res://scripts/planet.gd" id="1_cktii"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_cktii"]
|
||||||
|
radius = 31.112698
|
||||||
|
|
||||||
[node name="planet" type="Node2D"]
|
[node name="planet" type="Node2D"]
|
||||||
script = ExtResource("1_cktii")
|
script = ExtResource("1_cktii")
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_cktii")
|
||||||
|
|||||||
@ -7,3 +7,37 @@ script = ExtResource("1_l8itw")
|
|||||||
|
|
||||||
[node name="background" type="Sprite2D" parent="."]
|
[node name="background" type="Sprite2D" parent="."]
|
||||||
position = Vector2(572.00006, 328.5)
|
position = Vector2(572.00006, 328.5)
|
||||||
|
|
||||||
|
[node name="PlanetStatPanel" type="Panel" parent="."]
|
||||||
|
offset_right = 284.0
|
||||||
|
offset_bottom = 169.0
|
||||||
|
|
||||||
|
[node name="PlanetName" type="Label" parent="PlanetStatPanel"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = 10.0
|
||||||
|
offset_right = 260.0
|
||||||
|
offset_bottom = 35.0
|
||||||
|
|
||||||
|
[node name="PopulationPanel" type="Label" parent="PlanetStatPanel"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_bottom = 0.277
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = 46.0
|
||||||
|
offset_right = 260.0
|
||||||
|
offset_bottom = 24.186996
|
||||||
|
|
||||||
|
[node name="ResourcePlanet" type="Label" parent="PlanetStatPanel"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = 82.0
|
||||||
|
offset_right = 260.0
|
||||||
|
offset_bottom = 107.0
|
||||||
|
|
||||||
|
[node name="MiningRate" type="Label" parent="PlanetStatPanel"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = 118.0
|
||||||
|
offset_right = 260.0
|
||||||
|
offset_bottom = 143.0
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="ui-planet-menu-0001"]
|
|
||||||
[node name="PlanetMenu" type="Panel"]
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 0.25
|
|
||||||
margin_left = 16.0
|
|
||||||
margin_top = 16.0
|
|
||||||
margin_right = -16.0
|
|
||||||
margin_bottom = -16.0
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="VBox" type="VBoxContainer" parent="."]
|
|
||||||
[node name="Label" type="Label" parent="VBox"]
|
|
||||||
text = "Planet: -"
|
|
||||||
[node name="BuildButton" type="Button" parent="VBox"]
|
|
||||||
text = "Build Mine"
|
|
||||||
|
|
||||||
[ext_resource path="res://scripts/planet_menu.gd" type="Script" id=1]
|
|
||||||
@ -1,21 +1,150 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
@onready var sprite = Sprite2D.new()
|
@onready var area = $Area2D
|
||||||
|
|
||||||
|
# Grafika
|
||||||
|
var sprite: Sprite2D = null
|
||||||
|
var colonized_icon: Sprite2D = null
|
||||||
|
|
||||||
|
var base_scale: Vector2 = Vector2(0.3, 0.3)
|
||||||
|
|
||||||
|
# Orbita
|
||||||
var orbit_center: Vector2
|
var orbit_center: Vector2
|
||||||
var orbit_radius: float
|
var orbit_radius: float
|
||||||
var rotation_speed: float
|
var rotation_speed: float = 0.02
|
||||||
var angle: float = 0.0
|
var angle: float = 0.0
|
||||||
|
|
||||||
|
# Statystyki planety
|
||||||
|
var population: int = 0
|
||||||
|
var mining_rate: float = 0.0
|
||||||
|
var resources: float = 0
|
||||||
|
var planet_name: String = "Planet"
|
||||||
|
|
||||||
|
# Rozmiar i potencjał
|
||||||
|
var planet_size: int = 1
|
||||||
|
var max_population: int = 0
|
||||||
|
var is_colonized: bool = false
|
||||||
|
|
||||||
|
# Czas od ostatniego przyrostu
|
||||||
|
var pop_timer: float = 0.0
|
||||||
|
var pop_interval: float = 30.0
|
||||||
|
|
||||||
|
# Sygnały
|
||||||
|
signal show_stats(planet)
|
||||||
|
signal hide_stats()
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
add_child(sprite)
|
_ensure_sprite()
|
||||||
angle = randf() * TAU
|
angle = randf() * TAU
|
||||||
|
|
||||||
|
# Ikona kolonizacji
|
||||||
|
colonized_icon = Sprite2D.new()
|
||||||
|
colonized_icon.texture = load("res://assets/icons/col_icon.png") # <-- podaj własną ścieżkę
|
||||||
|
colonized_icon.centered = true
|
||||||
|
colonized_icon.visible = false
|
||||||
|
colonized_icon.scale = Vector2(0.02, 0.02)
|
||||||
|
add_child(colonized_icon)
|
||||||
|
|
||||||
|
if area:
|
||||||
|
area.mouse_entered.connect(Callable(self, "_on_mouse_entered"))
|
||||||
|
area.mouse_exited.connect(Callable(self, "_on_mouse_exited"))
|
||||||
|
area.input_event.connect(Callable(self, "_on_area_input"))
|
||||||
|
|
||||||
|
func _on_area_input(viewport, event, shape_idx):
|
||||||
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
|
colonize()
|
||||||
|
|
||||||
|
func _ensure_sprite():
|
||||||
|
if sprite == null:
|
||||||
|
sprite = Sprite2D.new()
|
||||||
|
add_child(sprite)
|
||||||
|
sprite.centered = true
|
||||||
|
|
||||||
func set_texture(tex: Texture2D):
|
func set_texture(tex: Texture2D):
|
||||||
|
_ensure_sprite()
|
||||||
sprite.texture = tex
|
sprite.texture = tex
|
||||||
sprite.centered = true
|
_apply_scale_for_size()
|
||||||
sprite.scale = Vector2(0.3, 0.3)
|
|
||||||
|
func set_size(new_size: int):
|
||||||
|
planet_size = clamp(new_size, 1, 4)
|
||||||
|
_apply_scale_for_size()
|
||||||
|
|
||||||
|
func _apply_scale_for_size():
|
||||||
|
match planet_size:
|
||||||
|
1:
|
||||||
|
base_scale = Vector2(0.20, 0.20)
|
||||||
|
max_population = 1000
|
||||||
|
2:
|
||||||
|
base_scale = Vector2(0.30, 0.30)
|
||||||
|
max_population = 5000
|
||||||
|
3:
|
||||||
|
base_scale = Vector2(0.42, 0.42)
|
||||||
|
max_population = 15000
|
||||||
|
4:
|
||||||
|
base_scale = Vector2(0.60, 0.60)
|
||||||
|
max_population = 30000
|
||||||
|
if sprite:
|
||||||
|
sprite.scale = base_scale
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
# Ruch planety po orbicie
|
||||||
angle += rotation_speed * delta
|
angle += rotation_speed * delta
|
||||||
position = orbit_center + Vector2(cos(angle), sin(angle)) * orbit_radius
|
if orbit_center and orbit_radius:
|
||||||
|
position = orbit_center + Vector2(cos(angle), sin(angle)) * orbit_radius
|
||||||
|
|
||||||
|
# Przyrost populacji i surowców
|
||||||
|
if is_colonized:
|
||||||
|
pop_timer += delta
|
||||||
|
if pop_timer >= pop_interval:
|
||||||
|
pop_timer = 0.0
|
||||||
|
_grow_population()
|
||||||
|
_mine_resources()
|
||||||
|
|
||||||
|
# Pozycja ikonki kolonizacji
|
||||||
|
if colonized_icon:
|
||||||
|
var y_offset = 0
|
||||||
|
if sprite and sprite.texture:
|
||||||
|
y_offset = -sprite.texture.get_size().y * 0.13
|
||||||
|
colonized_icon.position = Vector2(0, y_offset)
|
||||||
|
|
||||||
|
func _on_mouse_entered():
|
||||||
|
var hover_mul = 1.15
|
||||||
|
if sprite:
|
||||||
|
sprite.scale = base_scale * hover_mul
|
||||||
|
emit_signal("show_stats", self)
|
||||||
|
|
||||||
|
func _on_mouse_exited():
|
||||||
|
if sprite:
|
||||||
|
sprite.scale = base_scale
|
||||||
|
emit_signal("hide_stats")
|
||||||
|
|
||||||
|
func colonize():
|
||||||
|
if not is_colonized:
|
||||||
|
is_colonized = true
|
||||||
|
population = 10
|
||||||
|
print(planet_name + " has been colonized!")
|
||||||
|
emit_signal("show_stats", self)
|
||||||
|
if colonized_icon:
|
||||||
|
colonized_icon.visible = true
|
||||||
|
|
||||||
|
func add_population(amount: int):
|
||||||
|
population = min(population + amount, max_population)
|
||||||
|
|
||||||
|
func spend_resources(amount: int) -> bool:
|
||||||
|
if resources >= amount:
|
||||||
|
resources -= amount
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
|
||||||
|
func _grow_population():
|
||||||
|
var growth = int(population / 10) # +10%
|
||||||
|
add_population(growth)
|
||||||
|
|
||||||
|
func _mine_resources():
|
||||||
|
var mined = get_mined_per_cycle()
|
||||||
|
resources += mined
|
||||||
|
|
||||||
|
# --- NOWA FUNKCJA ---
|
||||||
|
# Zwraca ile surowców planeta wydobywa na jeden cykl (np. co 30 sekund)
|
||||||
|
func get_mined_per_cycle() -> float:
|
||||||
|
return mining_rate * pow(population, 0.5) * 0.05
|
||||||
|
|||||||
@ -2,27 +2,32 @@ extends Node2D
|
|||||||
|
|
||||||
var StarScene = preload("res://scenes/Star.tscn")
|
var StarScene = preload("res://scenes/Star.tscn")
|
||||||
var PlanetScene = preload("res://scenes/Planet.tscn")
|
var PlanetScene = preload("res://scenes/Planet.tscn")
|
||||||
|
@onready var PlanetStatPanel = $PlanetStatPanel
|
||||||
|
|
||||||
var PLANET_COUNT = randf_range(1,5)
|
var PLANET_COUNT = randi_range(1,6)
|
||||||
const ORBIT_STEP = 120
|
const ORBIT_STEP = 120
|
||||||
|
|
||||||
|
var planet_names = [
|
||||||
|
"Arcturus","Betelgeuse","Canopus","Deneb","Elnath",
|
||||||
|
"Fomalhaut","Gacrux","Hadar","Izar","Jabbah",
|
||||||
|
"Kaus","Lesath","Menkent","Nunki","Okul",
|
||||||
|
"Pollux","Rigel","Sargas","Toliman","Unukalhai",
|
||||||
|
"Vega","Wezen","Xamidimura","Yildun","Zosma",
|
||||||
|
"Alkaid","Baten","Caph","Diphda","Electra"
|
||||||
|
]
|
||||||
|
|
||||||
|
# Planeta, której statystyki są aktualnie pokazywane
|
||||||
|
var tracked_planet: Node = null
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
randomize()
|
randomize()
|
||||||
spawn_star()
|
spawn_star()
|
||||||
spawn_planets(PLANET_COUNT)
|
spawn_planets(PLANET_COUNT)
|
||||||
var background = Sprite2D.new()
|
_init_background()
|
||||||
background.texture = load("res://assets/background/space1.jpg")
|
|
||||||
background.centered = true
|
|
||||||
background.position = get_viewport_rect().size / 2
|
|
||||||
|
|
||||||
# 🔥 automatyczne dopasowanie do ekranu
|
func _process(delta):
|
||||||
var screen_size = get_viewport_rect().size
|
if tracked_planet != null:
|
||||||
var tex_size = background.texture.get_size()
|
_update_panel()
|
||||||
var scale_factor = max(screen_size.x / tex_size.x, screen_size.y / tex_size.y)
|
|
||||||
background.scale = Vector2(scale_factor, scale_factor)
|
|
||||||
|
|
||||||
add_child(background)
|
|
||||||
background.z_index = -10 # żeby zawsze był za planetami
|
|
||||||
|
|
||||||
func spawn_star():
|
func spawn_star():
|
||||||
var star = StarScene.instantiate()
|
var star = StarScene.instantiate()
|
||||||
@ -39,14 +44,30 @@ func spawn_planets(count: int):
|
|||||||
var orbit_radius = (i + 1) * ORBIT_STEP
|
var orbit_radius = (i + 1) * ORBIT_STEP
|
||||||
planet.orbit_radius = orbit_radius
|
planet.orbit_radius = orbit_radius
|
||||||
planet.orbit_center = center
|
planet.orbit_center = center
|
||||||
|
planet.rotation_speed = randf_range(0.01, 0.04)
|
||||||
|
|
||||||
# 🔥 Tutaj zmieniasz prędkość i powinno działać
|
planet.planet_size = randi_range(1, 3)
|
||||||
planet.rotation_speed = randf_range(0.01, 0.04) # wolno
|
planet.set_size(planet.planet_size)
|
||||||
# planet.rotation_speed = 1.0 # szybciej
|
planet.resources = 0
|
||||||
# planet.rotation_speed = 5.0 # bardzo szybko
|
planet.mining_rate = randf_range(0.1, 1.0)
|
||||||
|
planet.planet_name = planet_names[randi() % planet_names.size()]
|
||||||
planet.set_texture(random_planet_texture())
|
planet.set_texture(random_planet_texture())
|
||||||
|
|
||||||
|
planet.connect("show_stats", Callable(self, "_on_show_stats"))
|
||||||
|
planet.connect("hide_stats", Callable(self, "_on_hide_stats"))
|
||||||
|
|
||||||
|
func _init_background():
|
||||||
|
var background = Sprite2D.new()
|
||||||
|
background.texture = load("res://assets/background/space1.jpg")
|
||||||
|
background.centered = true
|
||||||
|
background.position = get_viewport_rect().size / 2
|
||||||
|
var screen_size = get_viewport_rect().size
|
||||||
|
var tex_size = background.texture.get_size()
|
||||||
|
var scale_factor = max(screen_size.x / tex_size.x, screen_size.y / tex_size.y)
|
||||||
|
background.scale = Vector2(scale_factor, scale_factor)
|
||||||
|
add_child(background)
|
||||||
|
background.z_index = -10
|
||||||
|
|
||||||
func random_star_texture() -> Texture2D:
|
func random_star_texture() -> Texture2D:
|
||||||
var id = randi_range(1, 16)
|
var id = randi_range(1, 16)
|
||||||
return load("res://assets/stars/s%d.png" % id)
|
return load("res://assets/stars/s%d.png" % id)
|
||||||
@ -54,3 +75,29 @@ func random_star_texture() -> Texture2D:
|
|||||||
func random_planet_texture() -> Texture2D:
|
func random_planet_texture() -> Texture2D:
|
||||||
var id = randi_range(1, 18)
|
var id = randi_range(1, 18)
|
||||||
return load("res://assets/planets/p%d.png" % id)
|
return load("res://assets/planets/p%d.png" % id)
|
||||||
|
|
||||||
|
# --- GUI ---
|
||||||
|
func _on_show_stats(planet):
|
||||||
|
tracked_planet = planet
|
||||||
|
PlanetStatPanel.visible = true
|
||||||
|
_update_panel()
|
||||||
|
|
||||||
|
func _on_hide_stats():
|
||||||
|
PlanetStatPanel.visible = false
|
||||||
|
tracked_planet = null
|
||||||
|
|
||||||
|
func _update_panel():
|
||||||
|
var colonized_text = ""
|
||||||
|
if tracked_planet.is_colonized:
|
||||||
|
colonized_text = " (Skolonizowana)"
|
||||||
|
PlanetStatPanel.get_node("PlanetName").text = "Name: " + tracked_planet.planet_name + colonized_text
|
||||||
|
|
||||||
|
PlanetStatPanel.get_node("PopulationPanel").text = ("Populacja: %d / %d" % [tracked_planet.population, tracked_planet.max_population])
|
||||||
|
|
||||||
|
PlanetStatPanel.get_node("MiningRate").text = ("Współczynnik wydobycia: %.2f" % tracked_planet.mining_rate)
|
||||||
|
|
||||||
|
var mined_per_cycle = tracked_planet.get_mined_per_cycle()
|
||||||
|
|
||||||
|
PlanetStatPanel.get_node("ResourcePlanet").text = (
|
||||||
|
"Surowce: %.2f (+%.2f / cykl)" % [tracked_planet.resources, mined_per_cycle]
|
||||||
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user