Merge branch 'musique_et_son_2' of https://git.zacharie-guet.fr/zacharie/seeding-planets into musique_et_son_2
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dadg6o6dl2k6t"
|
||||
path="res://.godot/imported/truck_music.ogg-71e4f19f9a59a19e62e72df06380f7df.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/audio_manager/assets/morceaux/autres/truck_music.ogg"
|
||||
dest_files=["res://.godot/imported/truck_music.ogg-71e4f19f9a59a19e62e72df06380f7df.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -22,6 +22,7 @@ func _ready():
|
||||
func(_s) : setup_volume()
|
||||
)
|
||||
SceneManager.scene_loaded.connect(_on_change_scene)
|
||||
Dialogic.timeline_started.connect(_on_timeline_started)
|
||||
|
||||
func _on_change_scene(scene : Scene):
|
||||
play_ambiance()
|
||||
@@ -35,6 +36,11 @@ func _on_change_scene(scene : Scene):
|
||||
"COCKPIT":
|
||||
play_music("Ship")
|
||||
|
||||
func _on_timeline_started():
|
||||
var timeline_name = Dialogic.current_timeline.resource_path.split("/")[-1].trim_suffix(".dtl")
|
||||
# Timeline name et le nom du fichier de timeline, par exemple demeter_intro
|
||||
# Amuse toi Niels ;)
|
||||
|
||||
func fetch_default_volumes():
|
||||
var all_players := get_all_players()
|
||||
|
||||
@@ -96,7 +102,6 @@ func play_music(music_name : String = ""):
|
||||
if old_music:
|
||||
await set_volume(old_music, MIN_VOLUME).finished
|
||||
if old_music and old_music != playing_music:
|
||||
print(old_music)
|
||||
old_music.stop()
|
||||
reset_volume(old_music)
|
||||
if music_name:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bg7jmrwdgdqg4"]
|
||||
[gd_scene format=3 uid="uid://bg7jmrwdgdqg4"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://baaujfw8piywi" path="res://common/icons/dna.svg" id="1_88fy1"]
|
||||
[ext_resource type="Script" uid="uid://bddlpqlfrydn8" path="res://common/vfx/particles/scripts/particles.gd" id="1_faap1"]
|
||||
[ext_resource type="Texture2D" uid="uid://baaujfw8piywi" path="res://common/icons/dna.svg" id="1_d4jao"]
|
||||
[ext_resource type="Script" uid="uid://bddlpqlfrydn8" path="res://common/vfx/particles/scripts/effect_particles.gd" id="2_u4sse"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_xmi7c"]
|
||||
_limits = [-200.0, 200.0, 0.0, 1.0]
|
||||
@@ -16,9 +16,9 @@ point_count = 2
|
||||
offsets = PackedFloat32Array(0, 0.80172414, 1)
|
||||
colors = PackedColorArray(1, 1, 1, 0.65882355, 1, 1, 1, 0.72156864, 1, 1, 1, 0)
|
||||
|
||||
[node name="Particles" type="CPUParticles2D"]
|
||||
[node name="Particles" type="CPUParticles2D" unique_id=222001900]
|
||||
amount = 1
|
||||
texture = ExtResource("1_88fy1")
|
||||
texture = ExtResource("1_d4jao")
|
||||
randomness = 0.3
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 30.0
|
||||
@@ -30,4 +30,4 @@ scale_amount_min = 0.4
|
||||
scale_amount_max = 0.6
|
||||
scale_amount_curve = SubResource("Curve_22a4c")
|
||||
color_ramp = SubResource("Gradient_li6gc")
|
||||
script = ExtResource("1_faap1")
|
||||
script = ExtResource("2_u4sse")
|
||||
12
common/vfx/particles/explosion_particles.tscn
Normal file
12
common/vfx/particles/explosion_particles.tscn
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_scene format=3 uid="uid://drf23tyb65cpc"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://rdrhi3r11ey6" path="res://common/icons/square-rounded.svg" id="1_60vma"]
|
||||
|
||||
[node name="ExplosionParticles" type="CPUParticles2D" unique_id=1558673457]
|
||||
emitting = false
|
||||
texture = ExtResource("1_60vma")
|
||||
one_shot = true
|
||||
direction = Vector2(0, -10)
|
||||
spread = 60.41
|
||||
initial_velocity_min = 156.29
|
||||
initial_velocity_max = 252.19
|
||||
@@ -1,5 +1,5 @@
|
||||
extends CPUParticles2D
|
||||
class_name Particles
|
||||
class_name EffectParticles
|
||||
|
||||
func setup_particles(param : Parameters):
|
||||
texture = param.texture
|
||||
@@ -3,24 +3,24 @@ class_name ItemObjectSprite
|
||||
|
||||
@onready var icon_sprite = $Icon
|
||||
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/particles.tscn")
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/effect_particles.tscn")
|
||||
|
||||
func apply_texture_to_sprite(texture, item_sprite_size = 50.):
|
||||
if texture:
|
||||
icon_sprite.texture = texture
|
||||
icon_sprite.scale = Vector2(
|
||||
1./(texture.get_width()/item_sprite_size),
|
||||
1./(texture.get_height()/item_sprite_size)
|
||||
)
|
||||
if texture:
|
||||
icon_sprite.texture = texture
|
||||
icon_sprite.scale = Vector2(
|
||||
1./(texture.get_width()/item_sprite_size),
|
||||
1./(texture.get_height()/item_sprite_size)
|
||||
)
|
||||
|
||||
func generate_particles(particles_params : Array[Particles.Parameters]):
|
||||
for c in get_children():
|
||||
if c is Particles: queue_free()
|
||||
func generate_particles(particles_params : Array[EffectParticles.Parameters]):
|
||||
for c in get_children():
|
||||
if c is EffectParticles: queue_free()
|
||||
|
||||
for params in particles_params:
|
||||
var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as Particles
|
||||
particles_emitter.setup_particles(params)
|
||||
add_child(particles_emitter)
|
||||
for params in particles_params:
|
||||
var particles_emitter : EffectParticles = PARTICLES_SCENE.instantiate() as EffectParticles
|
||||
particles_emitter.setup_particles(params)
|
||||
add_child(particles_emitter)
|
||||
|
||||
func pickup_animation():
|
||||
%AnimationPlayer.play("pickup")
|
||||
%AnimationPlayer.play("pickup")
|
||||
|
||||
@@ -4,7 +4,7 @@ class_name PlantSprite
|
||||
const PLANTED_SEED_CROP_WIDTH = 50
|
||||
const PLANTED_SEED_POS_Y = 0
|
||||
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/particles.tscn")
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/effect_particles.tscn")
|
||||
|
||||
signal harvest_animation_finished
|
||||
|
||||
@@ -30,9 +30,9 @@ func update_plant_sprite(plant_data : PlantData, with_animation = false):
|
||||
|
||||
func generate_mutation_effects(plant : Plant):
|
||||
for m in plant.data.mutations:
|
||||
var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as CPUParticles2D
|
||||
var particles_emitter : EffectParticles = PARTICLES_SCENE.instantiate() as EffectParticles
|
||||
particles_emitter.setup_particles(
|
||||
Particles.Parameters.new(
|
||||
EffectParticles.Parameters.new(
|
||||
m.get_icon(),
|
||||
PlantMutation.get_rarity_color(m.get_rarity())
|
||||
)
|
||||
|
||||
@@ -13,61 +13,61 @@ const ONE_TIME_ICON = preload("res://common/icons/circle-number-1.svg")
|
||||
@export var energy_usage : int = 1 : get = get_energy_used
|
||||
|
||||
func get_item_name() -> String:
|
||||
return name
|
||||
return name
|
||||
|
||||
func get_description() -> String:
|
||||
return description
|
||||
return description
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return icon
|
||||
return icon
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return energy_usage
|
||||
return energy_usage
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return usage_zone_radius
|
||||
return usage_zone_radius
|
||||
|
||||
func get_usage_object_affected(_i : InspectableEntity) -> bool:
|
||||
return false
|
||||
return false
|
||||
|
||||
func is_one_time_use():
|
||||
return false
|
||||
return false
|
||||
|
||||
func can_use(_player : Player, _zone: Player.ActionZone) -> bool:
|
||||
return false
|
||||
return false
|
||||
|
||||
func use_text() -> String:
|
||||
return ""
|
||||
return ""
|
||||
|
||||
func use(_player : Player, _zone: Player.ActionZone):
|
||||
return false
|
||||
return false
|
||||
|
||||
func card_info() -> CardInfo:
|
||||
var info = CardInfo.new(
|
||||
get_item_name()
|
||||
)
|
||||
info.texture = icon
|
||||
info.type_icon = TYPE_ICON
|
||||
var info = CardInfo.new(
|
||||
get_item_name()
|
||||
)
|
||||
info.texture = icon
|
||||
info.type_icon = TYPE_ICON
|
||||
|
||||
info.stats.append(
|
||||
CardStatInfo.new(
|
||||
str(energy_usage),
|
||||
ENERGY_ICON
|
||||
)
|
||||
)
|
||||
info.stats.append(
|
||||
CardStatInfo.new(
|
||||
str(energy_usage),
|
||||
ENERGY_ICON
|
||||
)
|
||||
)
|
||||
|
||||
var effect_section = CardSectionInfo.new(
|
||||
tr("EFFECT"),
|
||||
get_description()
|
||||
)
|
||||
effect_section.title_icon = ACTION_ICON
|
||||
var effect_section = CardSectionInfo.new(
|
||||
tr("EFFECT"),
|
||||
get_description()
|
||||
)
|
||||
effect_section.title_icon = ACTION_ICON
|
||||
|
||||
if energy_usage > 0:
|
||||
effect_section.title_icon = ENERGY_ICON
|
||||
|
||||
info.sections.append(effect_section)
|
||||
if energy_usage > 0:
|
||||
effect_section.title_icon = ENERGY_ICON
|
||||
|
||||
info.sections.append(effect_section)
|
||||
|
||||
return info
|
||||
return info
|
||||
|
||||
func get_particles() -> Array[Particles.Parameters]:
|
||||
return []
|
||||
func get_particles() -> Array[EffectParticles.Parameters]:
|
||||
return []
|
||||
|
||||
@@ -128,12 +128,12 @@ func card_info() -> CardInfo:
|
||||
|
||||
return info
|
||||
|
||||
func get_particles() -> Array[Particles.Parameters]:
|
||||
var param : Array[Particles.Parameters] = []
|
||||
func get_particles() -> Array[EffectParticles.Parameters]:
|
||||
var param : Array[EffectParticles.Parameters] = []
|
||||
|
||||
for m in plant_mutations:
|
||||
param.append(
|
||||
Particles.Parameters.new(
|
||||
EffectParticles.Parameters.new(
|
||||
m.get_icon(),
|
||||
PlantMutation.get_rarity_color(m.get_rarity())
|
||||
)
|
||||
|
||||
Binary file not shown.
BIN
gui/game/energy_info/assets/3d/battery.blend1
Normal file
BIN
gui/game/energy_info/assets/3d/battery.blend1
Normal file
Binary file not shown.
BIN
gui/game/energy_info/assets/3d/screen_battery.blend
Normal file
BIN
gui/game/energy_info/assets/3d/screen_battery.blend
Normal file
Binary file not shown.
68
gui/game/energy_info/assets/3d/screen_battery.blend.import
Normal file
68
gui/game/energy_info/assets/3d/screen_battery.blend.import
Normal file
@@ -0,0 +1,68 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://b13vhoha7fkr8"
|
||||
path="res://.godot/imported/screen_battery.blend-85248f134ff293ea54a84f3e6477980f.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/game/energy_info/assets/3d/screen_battery.blend"
|
||||
dest_files=["res://.godot/imported/screen_battery.blend-85248f134ff293ea54a84f3e6477980f.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
|
||||
BIN
gui/game/energy_info/assets/3d/screen_battery.blend1
Normal file
BIN
gui/game/energy_info/assets/3d/screen_battery.blend1
Normal file
Binary file not shown.
23
gui/game/energy_info/battery_3d.tscn
Normal file
23
gui/game/energy_info/battery_3d.tscn
Normal file
@@ -0,0 +1,23 @@
|
||||
[gd_scene format=3 uid="uid://c7n8vtfjaalpm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cgmt80g1322fn" path="res://gui/game/energy_info/scripts/battery_3d.gd" id="1_k6iqj"]
|
||||
[ext_resource type="PackedScene" uid="uid://ddfdj8lb24f6g" path="res://gui/game/energy_info/assets/3d/battery.blend" id="2_trgpr"]
|
||||
[ext_resource type="Texture2D" uid="uid://dlsx1mofjccib" path="res://common/assets/textures/3d_texture.png" id="3_4dn1y"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0785j"]
|
||||
atlas = ExtResource("3_4dn1y")
|
||||
region = Rect2(16.405571, 12.916401, 7.3732758, 36.0836)
|
||||
|
||||
[node name="Battery" type="Node3D" unique_id=250427516]
|
||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 0, 0, 0)
|
||||
script = ExtResource("1_k6iqj")
|
||||
powered = false
|
||||
|
||||
[node name="BatteryModel" parent="." unique_id=2087566235 instance=ExtResource("2_trgpr")]
|
||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 0, 0, 0)
|
||||
|
||||
[node name="NonPoweredBatteryGauge" type="Sprite3D" parent="." unique_id=419634974]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-9.0001855e-08, -0.008180644, 0.9999901, -1.1066229, -1.3152051, -0.003110032, 1.1066215, -1.3152068, -0.003109955, 0.28073934, 0.18676496, -0.05360138)
|
||||
centered = false
|
||||
texture = SubResource("AtlasTexture_0785j")
|
||||
@@ -5,7 +5,7 @@
|
||||
[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="PackedScene" uid="uid://d01cp8xl0rme4" path="res://gui/game/energy_info/energy_info_3d.tscn" id="6_tj7lw"]
|
||||
[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"]
|
||||
|
||||
@@ -29,9 +29,10 @@ stretch_mode = 2
|
||||
|
||||
[node name="IconPlacer" type="MarginContainer" parent="." unique_id=667163887]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
theme_override_constants/margin_top = 13
|
||||
theme_override_constants/margin_left = 23
|
||||
theme_override_constants/margin_top = 58
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 0
|
||||
|
||||
@@ -45,9 +46,9 @@ 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
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 9
|
||||
theme_override_constants/margin_right = 418
|
||||
|
||||
[node name="EnergyCount" type="RichTextLabel" parent="TextPlacer" unique_id=1073572949]
|
||||
unique_name_in_owner = true
|
||||
@@ -58,7 +59,7 @@ 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 = 70
|
||||
theme_override_font_sizes/bold_font_size = 40
|
||||
bbcode_enabled = true
|
||||
text = "[b]0[/b] / 3"
|
||||
fit_content = true
|
||||
@@ -73,20 +74,22 @@ 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)
|
||||
size = Vector2i(529, 190)
|
||||
|
||||
[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="EnergyInfo3d" parent="BatteryViewport" unique_id=1798644168 instance=ExtResource("6_tj7lw")]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.918, 2)
|
||||
max_energy = 3
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="BatteryViewport" unique_id=1322215759]
|
||||
environment = ExtResource("8_tj7lw")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="BatteryViewport" unique_id=597830916]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 15.465, -0.4, 0.1)
|
||||
fov = 10.1
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="BatteryViewport/Camera3D" unique_id=1583578016]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.057, -0.2)
|
||||
mesh = SubResource("QuadMesh_tj7lw")
|
||||
skeleton = NodePath("../..")
|
||||
surface_material_override/0 = ExtResource("7_rqwov")
|
||||
|
||||
16
gui/game/energy_info/energy_info_3d.tscn
Normal file
16
gui/game/energy_info/energy_info_3d.tscn
Normal file
@@ -0,0 +1,16 @@
|
||||
[gd_scene format=3 uid="uid://d01cp8xl0rme4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d1gwwha7syyo0" path="res://gui/game/energy_info/scripts/energy_info_3d.gd" id="1_6g71k"]
|
||||
[ext_resource type="PackedScene" uid="uid://b13vhoha7fkr8" path="res://gui/game/energy_info/assets/3d/screen_battery.blend" id="1_k4787"]
|
||||
|
||||
[node name="EnergyInfo3d" type="Node3D" unique_id=1798644168]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.917917, 0)
|
||||
script = ExtResource("1_6g71k")
|
||||
max_energy = 8
|
||||
energy = 3
|
||||
|
||||
[node name="screen_battery" parent="." unique_id=1178181269 instance=ExtResource("1_k4787")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.98991156, 0.84792256)
|
||||
|
||||
[node name="Batteries" type="Node3D" parent="." unique_id=170543488]
|
||||
unique_name_in_owner = true
|
||||
17
gui/game/energy_info/scripts/battery_3d.gd
Normal file
17
gui/game/energy_info/scripts/battery_3d.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
class_name Battery3d
|
||||
|
||||
const MAX_BATTERY_GAUGE_SPRITE_SCALE = 1.86
|
||||
|
||||
@export var powered : bool = true : set = set_powered
|
||||
|
||||
func _ready():
|
||||
set_powered()
|
||||
|
||||
func set_powered(_powered : bool = powered):
|
||||
var old_powered = powered
|
||||
powered = _powered
|
||||
if is_node_ready() and old_powered != powered:
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
tween.tween_property(%NonPoweredBatteryGauge, "scale:y", 0. if powered else MAX_BATTERY_GAUGE_SPRITE_SCALE, 0.3)
|
||||
1
gui/game/energy_info/scripts/battery_3d.gd.uid
Normal file
1
gui/game/energy_info/scripts/battery_3d.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cgmt80g1322fn
|
||||
@@ -23,5 +23,7 @@ func update(
|
||||
|
||||
# if with_animation:
|
||||
# %EnergyAnimationPlayer.bounce()
|
||||
%EnergyInfo3d.energy = energy
|
||||
%EnergyInfo3d.max_energy = max_energy
|
||||
%EnergyCount.text = energy_count_text
|
||||
%EnergyCount.modulate = Color.WHITE if energy > 0 else Color.RED
|
||||
37
gui/game/energy_info/scripts/energy_info_3d.gd
Normal file
37
gui/game/energy_info/scripts/energy_info_3d.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
|
||||
const BATTERY_SCENE = preload("res://gui/game/energy_info/battery_3d.tscn")
|
||||
const BATTERY_SHIFT = Vector3(0,0,-1)
|
||||
|
||||
@export var max_energy : int = 0 : set = set_max_energy
|
||||
@export var energy : int = 0 : set = set_energy
|
||||
|
||||
func _ready():
|
||||
set_max_energy()
|
||||
|
||||
func set_max_energy(_max_energy : int = max_energy):
|
||||
var old = max_energy
|
||||
max_energy = _max_energy
|
||||
if is_node_ready() and max_energy != len(%Batteries.get_children()):
|
||||
for c in %Batteries.get_children():
|
||||
c.queue_free()
|
||||
|
||||
for i in range(max_energy):
|
||||
var new_battery := BATTERY_SCENE.instantiate() as Battery3d
|
||||
%Batteries.add_child(new_battery)
|
||||
new_battery.position = BATTERY_SHIFT * i
|
||||
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
set_energy()
|
||||
|
||||
func set_energy(_energy : int = energy):
|
||||
energy = _energy
|
||||
if is_node_ready():
|
||||
var energy_count = 0
|
||||
for battery in %Batteries.get_children():
|
||||
if not battery.is_node_ready():
|
||||
await battery.ready
|
||||
if battery is Battery3d:
|
||||
battery.powered = energy_count < energy
|
||||
energy_count += 1
|
||||
1
gui/game/energy_info/scripts/energy_info_3d.gd.uid
Normal file
1
gui/game/energy_info/scripts/energy_info_3d.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d1gwwha7syyo0
|
||||
Binary file not shown.
Binary file not shown.
@@ -74,7 +74,7 @@ func _process(_d):
|
||||
func generate_first_entities():
|
||||
if not (Vector2i.ZERO in data.generated_chunk_entities):
|
||||
# Generate shovel
|
||||
drop_item(Shovel.new(), entity_container.global_position + Vector2(0, 100))
|
||||
drop_item(Pickaxe.new(), entity_container.global_position + Vector2(0, 100))
|
||||
|
||||
func get_chunk_key(coord) -> String:
|
||||
return "%d:%d" % [coord.x, coord.y]
|
||||
|
||||
@@ -123,15 +123,11 @@ func add_plant_data(plant_data : PlantData, with_update = true):
|
||||
_on_plant_updated(plant_data)
|
||||
|
||||
func _on_plant_updated(plant_data : PlantData):
|
||||
print("for plant %s" % plant_data.plant_name)
|
||||
var old_plant_score = score_by_plant[plant_data]
|
||||
print("old score = %d" % old_plant_score)
|
||||
score_by_plant[plant_data] = plant_data.get_score()
|
||||
print("new score = %d" % score_by_plant[plant_data])
|
||||
|
||||
|
||||
if old_plant_score != score_by_plant[plant_data]:
|
||||
print("plant changin score")
|
||||
plant_changing_score.emit(plant_data, score_by_plant[plant_data] - old_plant_score)
|
||||
update()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user