diff --git a/components/UI/SkillIcon.tscn b/components/UI/SkillIcon.tscn index ed89342..c68eac7 100644 --- a/components/UI/SkillIcon.tscn +++ b/components/UI/SkillIcon.tscn @@ -3,7 +3,7 @@ [ext_resource type="Shader" uid="uid://u6weu6llk46k" path="res://shaders/CooldownProgress.gdshader" id="1_jaivk"] [ext_resource type="Script" uid="uid://bp8catom6i0ul" path="res://scripts/Statemachine/SkillIcon.gd" id="1_l7say"] [ext_resource type="Texture2D" uid="uid://cp4ypuarjoshp" path="res://resources/skillIcons/purple-crystal.png" id="2_hh1bl"] -[ext_resource type="Texture2D" uid="uid://chqmaeivt84b5" path="res://resources/common/attackstar.svg" id="4_50rim"] +[ext_resource type="Texture2D" uid="uid://bmpo06vnnywim" path="res://resources/common/whitecircle.svg" id="4_blv04"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_3fyf3"] shader = ExtResource("1_jaivk") @@ -33,7 +33,7 @@ curve = SubResource("Curve_rgp6n") [sub_resource type="Curve" id="Curve_h7g2c"] _limits = [0.0, 2.0, 0.0, 1.0] -_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 2), 0.0, 0.0, 0, 0] +_data = [Vector2(0, 0.4), 0.0, 0.0, 0, 0, Vector2(1, 0.6), 0.0, 0.0, 0, 0] point_count = 2 [sub_resource type="CurveTexture" id="CurveTexture_05v0d"] @@ -66,8 +66,6 @@ stretch_mode = 5 [node name="particle" type="GPUParticles2D" parent="."] unique_name_in_owner = true position = Vector2(20, 20) -emitting = false -amount = 1 -texture = ExtResource("4_50rim") -one_shot = true +amount = 2 +texture = ExtResource("4_blv04") process_material = SubResource("ParticleProcessMaterial_7cgpa") diff --git a/resources/common/whitecircle.svg b/resources/common/whitecircle.svg new file mode 100644 index 0000000..f1ed2c4 --- /dev/null +++ b/resources/common/whitecircle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/common/whitecircle.svg.import b/resources/common/whitecircle.svg.import new file mode 100644 index 0000000..0e2fe7a --- /dev/null +++ b/resources/common/whitecircle.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bmpo06vnnywim" +path="res://.godot/imported/whitecircle.svg-1ed5ca2d5c4f265484656a69d2464cdd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resources/common/whitecircle.svg" +dest_files=["res://.godot/imported/whitecircle.svg-1ed5ca2d5c4f265484656a69d2464cdd.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/scripts/Statemachine/CooldownTimer.gd b/scripts/Statemachine/CooldownTimer.gd index b98f5e6..d039c50 100644 --- a/scripts/Statemachine/CooldownTimer.gd +++ b/scripts/Statemachine/CooldownTimer.gd @@ -18,3 +18,5 @@ func start(): return state func timeSinceLastStart(): return WorldManager.getTime() - lastStart +func percent(): + return timeSinceLastStart() / centralTime() diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd index c4a63d9..cf9d4bf 100644 --- a/scripts/Statemachine/EntityBase.gd +++ b/scripts/Statemachine/EntityBase.gd @@ -277,8 +277,12 @@ func collectItem(itemType: ItemStore.ItemType, amount: int): func storeEnergy(value: float, dontChangeDirection: bool = false): energy += value * fields.get(FieldStore.Entity.ENERGY_MULTIPILER) energyChanged.emit(energy, dontChangeDirection) +func finalEnergy(base: float): + return base / fields.get(FieldStore.Entity.SAVE_ENERGY) +func fillingProgress(base: float): + return energy / finalEnergy(base) func useEnergy(value: float): - value /= fields.get(FieldStore.Entity.SAVE_ENERGY) + value = finalEnergy(value) var state = energy >= value if state: energy -= value diff --git a/scripts/Statemachine/SkillIcon.gd b/scripts/Statemachine/SkillIcon.gd index 6c896a6..c6d0754 100644 --- a/scripts/Statemachine/SkillIcon.gd +++ b/scripts/Statemachine/SkillIcon.gd @@ -13,11 +13,11 @@ func _ready(): func _physics_process(_delta): if is_instance_valid(weapon): textureRect.texture = weapon.avatarTexture - var progress = min(weapon.cooldownTimer.timeSinceLastStart() / weapon.cooldownTimer.cooldown, UIState.player.energy / weapon.needEnergy) + var progress = min(weapon.cooldownTimer.percent(), UIState.player.fillingProgress(weapon.needEnergy)) material.set_shader_parameter("progress", progress) + particle.emitting = progress >= 1 if progress >= 1: if !showed: showed = true - particle.emitting = true else: showed = false