mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(技能图标): 添加冷却进度百分比功能并优化能量显示
为CooldownTimer添加percent方法计算冷却进度百分比 重构SkillIcon使用新的冷却进度和能量填充进度计算 添加白色圆圈SVG资源作为粒子效果 优化EntityBase的能量计算方法 更新SkillIcon场景配置
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg width="103" height="104" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" overflow="hidden"><g transform="translate(-551 -482)"><path d="M555 534C555 507.49 576.49 486 603 486 629.51 486 651 507.49 651 534 651 560.51 629.51 582 603 582 576.49 582 555 560.51 555 534Z" stroke="#FFFFFF" stroke-width="6" stroke-miterlimit="8" fill="none" fill-rule="evenodd"/></g></svg>
|
||||
|
After Width: | Height: | Size: 401 B |
@@ -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
|
||||
@@ -18,3 +18,5 @@ func start():
|
||||
return state
|
||||
func timeSinceLastStart():
|
||||
return WorldManager.getTime() - lastStart
|
||||
func percent():
|
||||
return timeSinceLastStart() / centralTime()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user