BoatParrtProgress und CampUI hinzugefügt
parent
da1fdf10d0
commit
08647a4188
|
|
@ -3,15 +3,15 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://di16cmfomo60u"
|
||||
path="res://.godot/imported/intro.png-5733d5421d999e0273f5c7e8c62d2491.ctex"
|
||||
path="res://.godot/imported/Intro.png-ef37c38298536b7c161e4863253f3325.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/intro.png"
|
||||
dest_files=["res://.godot/imported/intro.png-5733d5421d999e0273f5c7e8c62d2491.ctex"]
|
||||
source_file="res://assets/images/Intro.png"
|
||||
dest_files=["res://.godot/imported/Intro.png-ef37c38298536b7c161e4863253f3325.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -15,6 +15,7 @@ var tilemap_types: TileMapTileTypes = TileMapTileTypes.new()
|
|||
@onready var time_of_day_bar: ProgressBar = %TimeOfDayBar
|
||||
|
||||
var tilemap_navigation: TilemapNavigation = TilemapNavigation.new()
|
||||
var camp: CampManager = CampManager.new()
|
||||
|
||||
@onready var tree_visualizer: BehaviorTreeVisualizer = %TreeVisualizer
|
||||
|
||||
|
|
@ -31,7 +32,11 @@ func _ready() -> void:
|
|||
world.camp_manager.game_manager = self
|
||||
world.step_visualizer.game_manager = self
|
||||
world.step_visualizer.world = world
|
||||
camp.camp_add_item(tilemap_types.OBJECT_I_BERRY)
|
||||
camp.camp_add_item(tilemap_types.OBJECT_I_STICK)
|
||||
update_bars()
|
||||
update_camp_ui()
|
||||
update_boat_progress()
|
||||
call_deferred("defer_ready")
|
||||
|
||||
|
||||
|
|
@ -123,6 +128,7 @@ func _on_game_tick_timeout() -> void:
|
|||
EventsTracker.populate_visual_log(%RecentEventsLog, self)
|
||||
|
||||
update_bars()
|
||||
update_boat_progress()
|
||||
handle_result_game_state(player.behavior_tree.blackboard)
|
||||
|
||||
if not game_ticker.is_stopped():
|
||||
|
|
@ -174,6 +180,82 @@ func handle_result_game_state(blackboard: Dictionary) -> void:
|
|||
get_tree().create_tween().tween_method(set_outro_opacity, 0.0, 1.0, 1.0)
|
||||
|
||||
|
||||
func update_boat_progress() -> void:
|
||||
|
||||
# Dictionary zur Zählung der Bootsteile
|
||||
var part_counts = {
|
||||
tilemap_types.OBJECT_I_BOAT_PART_ENGINE: 0,
|
||||
tilemap_types.OBJECT_I_BOAT_PART_FUEL: 0,
|
||||
tilemap_types.OBJECT_I_BOAT_PART_ANCHOR: 0,
|
||||
tilemap_types.OBJECT_I_BOAT_PART_CHEST: 0,
|
||||
tilemap_types.OBJECT_I_BOAT_PART_GEARS: 0,
|
||||
tilemap_types.OBJECT_I_BOAT_PART_MEDIKIT: 0,
|
||||
tilemap_types.OBJECT_I_BOAT_PART_PADDLE: 0,
|
||||
tilemap_types.OBJECT_I_BOAT_PART_GAS_STOVE: 0
|
||||
}
|
||||
|
||||
# Teile in boat_items zählen
|
||||
for boat_part in world.camp_manager.boat_items:
|
||||
if part_counts.has(boat_part):
|
||||
part_counts[boat_part] += 1
|
||||
|
||||
# Aktualisiere die UI basierend auf den gezählten Teilen
|
||||
for part in part_counts.keys():
|
||||
var count = part_counts[part]
|
||||
if count > 0:
|
||||
if part == tilemap_types.OBJECT_I_BOAT_PART_ENGINE:
|
||||
%BoatPartEngine.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_ENGINE)
|
||||
%BoatPartEngine.visible = true
|
||||
%EngineCount.text = str(count)
|
||||
elif part == tilemap_types.OBJECT_I_BOAT_PART_FUEL:
|
||||
%BoatPartFuel.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_FUEL)
|
||||
%BoatPartFuel.visible = true
|
||||
%FuelCount.text = str(count)
|
||||
elif part == tilemap_types.OBJECT_I_BOAT_PART_ANCHOR:
|
||||
%BoatPartAnchor.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_ANCHOR)
|
||||
%BoatPartAnchor.visible = true
|
||||
%AnchorCount.text = str(count)
|
||||
elif part == tilemap_types.OBJECT_I_BOAT_PART_CHEST:
|
||||
%BoatPartChest.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_CHEST)
|
||||
%BoatPartChest.visible = true
|
||||
%ChestCount.text = str(count)
|
||||
elif part == tilemap_types.OBJECT_I_BOAT_PART_GEARS:
|
||||
%BoatPartGears.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_GEARS)
|
||||
%BoatPartGears.visible = true
|
||||
%GearsCount.text = str(count)
|
||||
elif part == tilemap_types.OBJECT_I_BOAT_PART_MEDIKIT:
|
||||
%BoatPartMedikit.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_MEDIKIT)
|
||||
%BoatPartMedikit.visible = true
|
||||
%MedikitCount.text = str(count)
|
||||
elif part == tilemap_types.OBJECT_I_BOAT_PART_PADDLE:
|
||||
%BoatPartPaddle.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_PADDLE)
|
||||
%BoatPartPaddle.visible = true
|
||||
%PaddleCount.text = str(count)
|
||||
elif part == tilemap_types.OBJECT_I_BOAT_PART_GAS_STOVE:
|
||||
%BoatPartGasStove.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_GAS_STOVE)
|
||||
%BoatPartGasStove.visible = true
|
||||
%StoveCount.text = str(count)
|
||||
else:
|
||||
push_error("Unknown boat part: " + str(part))
|
||||
|
||||
|
||||
func update_camp_ui() -> void:
|
||||
# Get the count of berries and sticks from the camp inventory
|
||||
var berry_count_value = camp.camp_item_count(tilemap_types.OBJECT_I_BERRY)
|
||||
var stick_count_value = camp.camp_item_count(tilemap_types.OBJECT_I_STICK)
|
||||
|
||||
# Update Berry UI
|
||||
%BerryCount.text = str(berry_count_value) # Update the count label
|
||||
%BerryTexture.visible = berry_count_value > 0 # Show texture only if count > 0
|
||||
if berry_count_value > 0:
|
||||
%BerryTexture.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BERRY)
|
||||
|
||||
# Update Stick UI
|
||||
%StickCount.text = str(stick_count_value) # Update the count label
|
||||
%StickTexture.visible = stick_count_value > 0 # Show texture only if count > 0
|
||||
if stick_count_value > 0:
|
||||
%StickTexture.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_STICK)
|
||||
|
||||
func update_bars() -> void:
|
||||
if health_bar != null:
|
||||
health_bar.max_value = player.max_health
|
||||
|
|
|
|||
|
|
@ -110,12 +110,20 @@ func camp_take_item(item: Vector2i, count: int = 1) -> bool:
|
|||
break
|
||||
|
||||
EventsTracker.track(EventsTracker.Event.CAMP_TAKEN_ITEM, {"item": item, "count": count})
|
||||
if game_manager:
|
||||
game_manager.update_camp_ui()
|
||||
return true
|
||||
|
||||
|
||||
func camp_add_item(item: Vector2i) -> void:
|
||||
camp_items.append(item)
|
||||
if tilemap_types.is_part_of_collection(tilemap_types.OBJECT_COLLECTION_BOAT_PARTS, item):
|
||||
if not boat_items.has(item):
|
||||
boat_items.append(item)
|
||||
EventsTracker.track(EventsTracker.Event.CAMP_ADDED_ITEM, {"item": item, "count": 1, "new_count": camp_item_count(item)})
|
||||
if game_manager:
|
||||
game_manager.update_camp_ui()
|
||||
|
||||
|
||||
|
||||
func campfire_light() -> bool:
|
||||
|
|
|
|||
Loading…
Reference in New Issue