diff --git a/render/material/effect_hit.tres b/render/material/effect_hit.tres new file mode 100644 index 0000000..9c74ad0 --- /dev/null +++ b/render/material/effect_hit.tres @@ -0,0 +1,11 @@ +[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://tlhcll6fyp7q"] + +[ext_resource type="Shader" path="res://render/shader/effect_billboard.gdshader" id="1_jw6vt"] +[ext_resource type="Texture2D" uid="uid://bb0yfk0u4lqqn" path="res://render/texture/shape/flare.png" id="2_x6l5a"] + +[resource] +render_priority = 0 +shader = ExtResource("1_jw6vt") +shader_parameter/glow_color = Color(0.933333, 1, 1, 1) +shader_parameter/intensity = 0.5 +shader_parameter/tex_main = ExtResource("2_x6l5a") diff --git a/render/material/effect_slash.tres b/render/material/effect_slash.tres index 1eefeac..8f371d2 100644 --- a/render/material/effect_slash.tres +++ b/render/material/effect_slash.tres @@ -1,6 +1,6 @@ [gd_resource type="ShaderMaterial" load_steps=5 format=3 uid="uid://dtyosukxpf33d"] -[ext_resource type="Shader" path="res://render/shader/effect.gdshader" id="1_s5fvm"] +[ext_resource type="Shader" path="res://render/shader/effect_slash.gdshader" id="1_s5fvm"] [ext_resource type="Texture2D" uid="uid://dd3e7ol8qa5eq" path="res://render/texture/noise/noise2.png" id="2_gu3jv"] [ext_resource type="Texture2D" uid="uid://c4byf37he3mjt" path="res://render/texture/noise/noise1.png" id="3_p66ui"] [ext_resource type="Texture2D" uid="uid://cksxjvafx2skm" path="res://render/texture/mask/mask5.png" id="3_r0nln"] diff --git a/render/process_material/hit_normal.tres b/render/process_material/hit_normal.tres new file mode 100644 index 0000000..4e9e32c --- /dev/null +++ b/render/process_material/hit_normal.tres @@ -0,0 +1,22 @@ +[gd_resource type="ParticleProcessMaterial" load_steps=5 format=3 uid="uid://bns2vfyf2qy6u"] + +[sub_resource type="Gradient" id="Gradient_fjosh"] +offsets = PackedFloat32Array(0, 0.0894942, 0.684825, 1) +colors = PackedColorArray(0.278431, 0.65098, 1, 0, 0.278431, 0.65098, 1, 1, 0.278431, 0.65098, 1, 0.941176, 0.278431, 0.65098, 1, 0) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_cypke"] +gradient = SubResource("Gradient_fjosh") + +[sub_resource type="Curve" id="Curve_igjlk"] +min_value = 2.0 +max_value = 4.0 +_data = [Vector2(0, 4), 0.0, 0.0, 0, 0, Vector2(1, 2), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_5xayb"] +curve = SubResource("Curve_igjlk") + +[resource] +gravity = Vector3(0, 0, 0) +scale_curve = SubResource("CurveTexture_5xayb") +color_ramp = SubResource("GradientTexture1D_cypke") diff --git a/render/shader/effect_billboard.gdshader b/render/shader/effect_billboard.gdshader new file mode 100644 index 0000000..8650669 --- /dev/null +++ b/render/shader/effect_billboard.gdshader @@ -0,0 +1,20 @@ +shader_type spatial; +render_mode blend_add,unshaded; + +uniform sampler2D tex_main : source_color; + +//void vertex() { + //mat4 modified_model_view = VIEW_MATRIX * mat4( + //INV_VIEW_MATRIX[0], + //INV_VIEW_MATRIX[1], + //INV_VIEW_MATRIX[2], + //MODEL_MATRIX[3] + //); + //MODELVIEW_MATRIX = modified_model_view; +//} + +void fragment() { + vec4 col = texture(tex_main, UV); + ALBEDO = mix(col.rgb, COLOR.rgb, COLOR.a); + ALPHA = col.r; +} diff --git a/render/shader/effect.gdshader b/render/shader/effect_slash.gdshader similarity index 100% rename from render/shader/effect.gdshader rename to render/shader/effect_slash.gdshader diff --git a/render/texture/shape/flare.png b/render/texture/shape/flare.png new file mode 100644 index 0000000..c4f9cef Binary files /dev/null and b/render/texture/shape/flare.png differ diff --git a/render/texture/shape/flare.png.import b/render/texture/shape/flare.png.import new file mode 100644 index 0000000..d2fa420 --- /dev/null +++ b/render/texture/shape/flare.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bb0yfk0u4lqqn" +path="res://.godot/imported/flare.png-3c5c77b68c2b446923833d2d81d06ac1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://render/texture/shape/flare.png" +dest_files=["res://.godot/imported/flare.png-3c5c77b68c2b446923833d2d81d06ac1.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=0 +compress/normal_map=2 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=false +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=0 diff --git a/scene/effect/particle/particle_hit_normal.tscn b/scene/effect/particle/particle_hit_normal.tscn new file mode 100644 index 0000000..1c16f3d --- /dev/null +++ b/scene/effect/particle/particle_hit_normal.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=5 format=3 uid="uid://io1yfgjm480t"] + +[ext_resource type="Script" path="res://script/effect/particle.gd" id="1_qxvm2"] +[ext_resource type="Material" uid="uid://tlhcll6fyp7q" path="res://render/material/effect_hit.tres" id="2_54a52"] +[ext_resource type="Material" uid="uid://bns2vfyf2qy6u" path="res://render/process_material/hit_normal.tres" id="3_1alqw"] + +[sub_resource type="QuadMesh" id="QuadMesh_0j7av"] + +[node name="Particle" type="Node3D"] +script = ExtResource("1_qxvm2") + +[node name="Slash" type="GPUParticles3D" parent="."] +material_override = ExtResource("2_54a52") +cast_shadow = 0 +emitting = false +amount = 1 +lifetime = 0.25 +one_shot = true +fixed_fps = 60 +local_coords = true +process_material = ExtResource("3_1alqw") +draw_pass_1 = SubResource("QuadMesh_0j7av") diff --git a/scene/effect/particle/particle_slash_normal.tscn b/scene/effect/particle/particle_slash_normal.tscn index f269094..7dc3f25 100644 --- a/scene/effect/particle/particle_slash_normal.tscn +++ b/scene/effect/particle/particle_slash_normal.tscn @@ -6,7 +6,6 @@ [ext_resource type="ArrayMesh" uid="uid://dq207a0waxk0j" path="res://render/mesh/slash1.obj" id="3_idjnm"] [node name="Particle" type="Node3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.699187, 4.61636) script = ExtResource("1_fx8ev") [node name="Slash" type="GPUParticles3D" parent="."] diff --git a/scene/launcher.tscn b/scene/launcher.tscn index ed9019c..0675733 100644 --- a/scene/launcher.tscn +++ b/scene/launcher.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=3 uid="uid://eoydwrunmm5n"] +[gd_scene load_steps=11 format=3 uid="uid://eoydwrunmm5n"] [ext_resource type="Script" path="res://script/manager/game_manager.gd" id="1_q2t80"] [ext_resource type="Script" path="res://script/manager/level_manager.gd" id="2_ewhkj"] @@ -9,6 +9,7 @@ [ext_resource type="PackedScene" uid="uid://cc525u8auypjf" path="res://scene/ui/profile_screen.tscn" id="6_u1fxn"] [ext_resource type="PackedScene" uid="uid://126wph4owvoy" path="res://scene/ui/hud_screen.tscn" id="7_gx646"] [ext_resource type="Script" path="res://script/manager/effect_manager.gd" id="8_0jv87"] +[ext_resource type="PackedScene" uid="uid://io1yfgjm480t" path="res://scene/effect/particle/particle_hit_normal.tscn" id="10_6naak"] [node name="Root" type="Node3D"] @@ -57,4 +58,6 @@ script = ExtResource("8_0jv87") [node name="EditorTool" type="Node3D" parent="."] script = ExtResource("5_n3qhi") +[node name="Particle" parent="." instance=ExtResource("10_6naak")] + [connection signal="item_rect_changed" from="GameManager/Stage" to="GameManager/Stage" method="_on_item_rect_changed"] diff --git a/script/character/battle.gd b/script/character/battle.gd index 1801e6f..aab0bd5 100644 --- a/script/character/battle.gd +++ b/script/character/battle.gd @@ -165,6 +165,9 @@ func settle(hit_info:HitInfo): character_to.add_buff("hit_back",attack.hit_back_duration) character_to.add_buff("hit_up",attack.hit_up_duration) + #受击特效 + character_to.cast_particle(ResourceManager.particle_hit_normal) + #抖动 character_to.add_buff("shake_x",0.2,true) diff --git a/script/character/character.gd b/script/character/character.gd index ee41d06..31961ab 100644 --- a/script/character/character.gd +++ b/script/character/character.gd @@ -92,3 +92,4 @@ func show_hit_text(value:String):SignalManager.character_hit_text.emit(id(),valu func show_hit_damage(value:float):SignalManager.character_hit_damage.emit(id(),value) func add_mp(value:float):battle.add_mp(value) func set_target(target:int):set_status("target",target);SignalManager.character_target_changed.emit(id(),target) +func cast_particle(resource:Resource):effect.cast_particle(resource) diff --git a/script/character/effect.gd b/script/character/effect.gd index 3dc64ce..a3e5d65 100644 --- a/script/character/effect.gd +++ b/script/character/effect.gd @@ -56,11 +56,14 @@ func cast_corpse():cast_image(corpse) func cast_attack_particle(): if !status.skill_cfg: return - var particle = status.skill_cfg.attack_particle as Resource - if !particle: - print("未配置技能攻击特效",status.skill_cfg) + var resource = status.skill_cfg.attack_particle as Resource + cast_particle(resource) + +func cast_particle(resource:Resource): + if !resource: + print("未配置技能特效") return - var new_particle = particle.instantiate() as Particle + var new_particle = resource.instantiate() as Particle new_particle.position = status.basic_offset new_particle.name = "attack_particle" var dir = status.skill_dir diff --git a/script/manager/resource_manager.gd b/script/manager/resource_manager.gd index b45b9a4..4a03c73 100644 --- a/script/manager/resource_manager.gd +++ b/script/manager/resource_manager.gd @@ -7,6 +7,9 @@ var scene_monster = load("res://scene/character/monster.tscn") #==material== var material_character = load("res://render/material/character.tres") +#==effect== +var particle_hit_normal = load("res://scene/effect/particle/particle_hit_normal.tscn") + #==config== #character var cfg_character_player = load("res://config/character/hero01.tres")