ajout d'une gui en 3d, d'un tuto et correction de bug à la pelletée

This commit is contained in:
2026-02-07 00:22:12 +01:00
parent 5722fbb437
commit 3fa84994cd
45 changed files with 885 additions and 321 deletions

Binary file not shown.

View File

@@ -0,0 +1,68 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://ddfdj8lb24f6g"
path="res://.godot/imported/battery.blend-724853c18018bdd43a8c1a47a4cb5ee6.scn"
[deps]
source_file="res://gui/game/energy_info/assets/3d/battery.blend"
dest_files=["res://.godot/imported/battery.blend-724853c18018bdd43a8c1a47a4cb5ee6.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={
"materials": {
"Material": {
"use_external/enabled": true,
"use_external/fallback_path": "res://common/assets/materials/default_3d.tres",
"use_external/path": "uid://dvvi1k5c5iowc"
}
}
}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/gpu_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true
gltf/naming_version=2

View File

@@ -1,37 +1,55 @@
[gd_scene load_steps=6 format=3 uid="uid://brfsapvj2quxm"]
[gd_scene format=3 uid="uid://brfsapvj2quxm"]
[ext_resource type="Script" uid="uid://0dhj8sdpil7q" path="res://gui/tools/control_animation_player.gd" id="1_g7kwx"]
[ext_resource type="Script" uid="uid://b77b1yr81r462" path="res://gui/game/energy_info/scripts/energy_info.gd" id="1_h7p5h"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="2_h7p5h"]
[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="3_c14dn"]
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="4_rqwov"]
[ext_resource type="PackedScene" uid="uid://ddfdj8lb24f6g" path="res://gui/game/energy_info/assets/3d/battery.blend" id="6_c14dn"]
[ext_resource type="Material" uid="uid://cr7bp4fhh1ipr" path="res://entities/player_3d/resources/materials/post_process_quad.tres" id="7_rqwov"]
[ext_resource type="Environment" uid="uid://bxyp24f85p0xf" path="res://gui/game/assets/gui_3d_environment.tres" id="8_tj7lw"]
[node name="EnergyInfo" type="HBoxContainer"]
modulate = Color(1, 0, 0, 1)
offset_right = 167.0
offset_bottom = 75.0
[sub_resource type="ViewportTexture" id="ViewportTexture_h7p5h"]
viewport_path = NodePath("BatteryViewport")
[sub_resource type="QuadMesh" id="QuadMesh_tj7lw"]
size = Vector2(2, 2)
[node name="EnergyInfo" type="MarginContainer" unique_id=698017539]
offset_right = 144.0
offset_bottom = 184.0
size_flags_horizontal = 2
size_flags_vertical = 0
theme_override_constants/separation = 0
alignment = 1
script = ExtResource("1_h7p5h")
wanted_max_energy = 3
[node name="EnergyAnimationPlayer" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("1_g7kwx")
metadata/_custom_type_script = "uid://0dhj8sdpil7q"
[node name="MarginContainer" type="MarginContainer" parent="."]
[node name="TextureRect" type="TextureRect" parent="." unique_id=1995434270]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 0
theme_override_constants/margin_left = 0
theme_override_constants/margin_top = -25
theme_override_constants/margin_right = 0
theme_override_constants/margin_bottom = -15
texture = SubResource("ViewportTexture_h7p5h")
stretch_mode = 2
[node name="EnergyCount" type="RichTextLabel" parent="MarginContainer"]
[node name="IconPlacer" type="MarginContainer" parent="." unique_id=667163887]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 0
theme_override_constants/margin_top = 13
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 0
[node name="Icon" type="TextureRect" parent="IconPlacer" unique_id=274278115]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
texture = ExtResource("4_rqwov")
expand_mode = 1
stretch_mode = 5
[node name="TextPlacer" type="MarginContainer" parent="." unique_id=1669037421]
layout_mode = 2
size_flags_vertical = 0
theme_override_constants/margin_left = 7
theme_override_constants/margin_top = 81
theme_override_constants/margin_right = 7
[node name="EnergyCount" type="RichTextLabel" parent="TextPlacer" unique_id=1073572949]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("2_h7p5h")
@@ -40,19 +58,35 @@ theme_override_fonts/bold_font = ExtResource("3_c14dn")
theme_override_fonts/bold_italics_font = ExtResource("3_c14dn")
theme_override_fonts/italics_font = ExtResource("3_c14dn")
theme_override_font_sizes/normal_font_size = 30
theme_override_font_sizes/bold_font_size = 100
theme_override_font_sizes/bold_font_size = 70
bbcode_enabled = true
text = "[b]0[/b] / 3"
fit_content = true
autowrap_mode = 0
horizontal_alignment = 1
vertical_alignment = 1
[node name="Icon" type="TextureRect" parent="."]
custom_minimum_size = Vector2(50, 50)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
texture = ExtResource("4_rqwov")
expand_mode = 4
stretch_mode = 5
[node name="EnergyAnimationPlayer" type="Node" parent="." unique_id=666526156]
unique_name_in_owner = true
script = ExtResource("1_g7kwx")
metadata/_custom_type_script = "uid://0dhj8sdpil7q"
[node name="BatteryViewport" type="SubViewport" parent="." unique_id=146346475]
own_world_3d = true
transparent_bg = true
size = Vector2i(144, 184)
[node name="battery" parent="BatteryViewport" unique_id=1405747982 instance=ExtResource("6_c14dn")]
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 0, 0, 0)
[node name="Camera3D" type="Camera3D" parent="BatteryViewport" unique_id=328545179]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 4.2918096, -0.38356447, 0)
current = true
fov = 39.9
[node name="MeshInstance3D" type="MeshInstance3D" parent="BatteryViewport" unique_id=1467847837]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 2.8120923, -0.4413929, 0)
mesh = SubResource("QuadMesh_tj7lw")
surface_material_override/0 = ExtResource("7_rqwov")
[node name="WorldEnvironment" type="WorldEnvironment" parent="BatteryViewport" unique_id=1322215759]
environment = ExtResource("8_tj7lw")

View File

@@ -1,5 +1,5 @@
@tool
extends HBoxContainer
extends MarginContainer
class_name EnergyInfo
@export var wanted_energy = 0
@@ -13,7 +13,7 @@ var max_energy := 0
func update(
_energy : int,
_max_energy : int,
with_animation := true,
_with_animation := true,
):
var changed = (energy != _energy or max_energy != _max_energy)
if changed:
@@ -24,4 +24,4 @@ func update(
# if with_animation:
# %EnergyAnimationPlayer.bounce()
%EnergyCount.text = energy_count_text
modulate = Color.WHITE if energy > 0 else Color.RED
%EnergyCount.modulate = Color.WHITE if energy > 0 else Color.RED