fix decal

master
chendian 1 year ago
parent 21b288986c
commit 22d8a8d3db

@ -5,7 +5,7 @@
[resource]
script = ExtResource("1_2fwsa")
damage_rate = 1.0
break_level = 2
break_level = 1
stun_attack = 10.0
damage_type = 1
is_floating = true

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dhq41finyfgpk"
path="res://.godot/imported/blood.png-afa7417b8132b6f361dab8c871f4a978.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://render/texture/decal/blood.png"
dest_files=["res://.godot/imported/blood.png-afa7417b8132b6f361dab8c871f4a978.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

@ -45,10 +45,10 @@ alpha_curve = SubResource("CurveTexture_vgydt")
script = ExtResource("1_2t2j1")
[node name="DecalExplode" type="Decal" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.358925, 0)
size = Vector3(1, 1, 1)
texture_albedo = ExtResource("2_vkpca")
modulate = Color(0, 0, 0, 1)
normal_fade = 0.999
upper_fade = 21.3037
cull_mask = 1
script = ExtResource("3_dwi0o")

@ -1,16 +1,9 @@
[gd_scene load_steps=14 format=3 uid="uid://b1eg05rgvdjk"]
[gd_scene load_steps=11 format=3 uid="uid://b1eg05rgvdjk"]
[ext_resource type="Script" path="res://script/effect/particle.gd" id="1_2t2j1"]
[ext_resource type="Texture2D" uid="uid://bjv7f83tdgq17" path="res://render/texture/decal/decal_explode.png" id="2_vkpca"]
[ext_resource type="Script" path="res://script/effect/particle_decal.gd" id="3_dwi0o"]
[ext_resource type="Shader" path="res://render/shader/particle_ground.gdshader" id="4_riq1c"]
[ext_resource type="Texture2D" uid="uid://cvm7ouwqnp235" path="res://render/texture/particle/shape/circle4.png" id="5_feq6c"]
[sub_resource type="Curve" id="Curve_yn1ni"]
max_value = 0.6
_data = [Vector2(0, 0), 0.0, 0.84, 0, 0, Vector2(0.0196078, 0.6), 0.0, 0.0, 0, 0, Vector2(1, 0.6), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0b0aa"]
render_priority = 0
shader = ExtResource("4_riq1c")
@ -44,18 +37,6 @@ alpha_curve = SubResource("CurveTexture_m6i4p")
[node name="Particle" type="Node3D"]
script = ExtResource("1_2t2j1")
[node name="DecalExplode" type="Decal" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.358925, 0)
visible = false
size = Vector3(1, 1, 1)
texture_albedo = ExtResource("2_vkpca")
modulate = Color(0, 0, 0, 1)
upper_fade = 21.3037
cull_mask = 1
script = ExtResource("3_dwi0o")
lifetime = 5.0
scale_curve = SubResource("Curve_yn1ni")
[node name="Shockwave" type="GPUParticles3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
layers = 512

@ -1,8 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://ccxyyunj4ohqt"]
[ext_resource type="Script" path="res://script/effect/particle.gd" id="1_6r6qw"]
[ext_resource type="Texture2D" uid="uid://dhq41finyfgpk" path="res://render/texture/decal/blood.png" id="2_op8c3"]
[ext_resource type="Script" path="res://script/effect/particle_decal.gd" id="3_yeg2u"]
[ext_resource type="Texture2D" uid="uid://b6bfacouwy2hi" path="res://render/texture/decal/decal_glow.png" id="6_8db0o"]
[sub_resource type="Gradient" id="Gradient_lwltf"]
offsets = PackedFloat32Array(0, 0.641834, 1)
@ -10,20 +10,22 @@ colors = PackedColorArray(0, 0, 0, 0.701961, 0, 0, 0, 0.629552, 0, 0, 0, 0)
[sub_resource type="Curve" id="Curve_w5jkx"]
max_value = 0.6
_data = [Vector2(0, 0.31259), 0.0, 0.953112, 0, 0, Vector2(0.0742705, 0.500205), 0.0, 0.0, 0, 0, Vector2(0.143236, 0.456295), 0.0, 0.0, 0, 0, Vector2(1, 0.6), 0.0, 0.0, 0, 0]
point_count = 4
_data = [Vector2(0, 0.31259), 0.0, 0.953112, 0, 0, Vector2(0.0795756, 0.6), 0.0, 0.0, 0, 0, Vector2(1, 0.6), 0.0, 0.0, 0, 0]
point_count = 3
[node name="Particle" type="Node3D"]
script = ExtResource("1_6r6qw")
[node name="DecalBlood" type="Decal" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.358925, 0)
size = Vector3(0.5, 5, 0.5)
texture_albedo = ExtResource("6_8db0o")
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
size = Vector3(1, 1, 1)
texture_albedo = ExtResource("2_op8c3")
modulate = Color(0, 0, 0, 1)
normal_fade = 0.999
upper_fade = 21.3037
cull_mask = 1
script = ExtResource("3_yeg2u")
lifetime = 3.0
gradient = SubResource("Gradient_lwltf")
scale_curve = SubResource("Curve_w5jkx")
size_random = 0.5

@ -6,5 +6,5 @@
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.358925, 0)
size = Vector3(1, 1, 1)
texture_albedo = ExtResource("1_30j48")
normal_fade = 0.1
normal_fade = 0.999
cull_mask = 1

@ -6,5 +6,5 @@
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.358925, 0)
size = Vector3(1, 1, 1)
texture_albedo = ExtResource("1_msawg")
normal_fade = 0.1
normal_fade = 0.999
cull_mask = 1

@ -6,5 +6,5 @@
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.358925, 0)
size = Vector3(1, 1, 1)
texture_albedo = ExtResource("1_2mpei")
normal_fade = 0.1
normal_fade = 0.999
cull_mask = 1

@ -6,5 +6,5 @@
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.358925, 0)
size = Vector3(1, 1, 1)
texture_albedo = ExtResource("1_hfi0a")
normal_fade = 0.1
normal_fade = 0.999
cull_mask = 1

@ -255,25 +255,26 @@ func settle(from: int, to: int, dir: Vector2, attack: AttackCfg) -> HitResult:
Global.item_mgr.create_pt(Enum.EPtType.MP, damage * Setting.pt_mp_damage_rate, character_to.pos())
#受击特效
var particle_hit: PackedScene
match attack.damage_type:
Enum.EDamageType.Sharp:
match break_level_sub:
-1: particle_hit = ResourceManager.particle_hit_sharp_block
0: particle_hit = ResourceManager.particle_hit_sharp_normal
1: particle_hit = ResourceManager.particle_hit_sharp_normal
2: particle_hit = ResourceManager.particle_hit_sharp_mid
3: particle_hit = ResourceManager.particle_hit_sharp_heavy
Enum.EDamageType.Blunt:
match break_level_sub:
-1: particle_hit = ResourceManager.particle_hit_blunt_block
0: particle_hit = ResourceManager.particle_hit_blunt_normal
1: particle_hit = ResourceManager.particle_hit_blunt_normal
2: particle_hit = ResourceManager.particle_hit_blunt_mid
3: particle_hit = ResourceManager.particle_hit_blunt_heavy
_: pass
if particle_hit:
character_to.cast_particle(particle_hit, false)
if not attack.is_throw_end:
var particle_hit: PackedScene
match attack.damage_type:
Enum.EDamageType.Sharp:
match break_level_sub:
-1: particle_hit = ResourceManager.particle_hit_sharp_block
0: particle_hit = ResourceManager.particle_hit_sharp_normal
1: particle_hit = ResourceManager.particle_hit_sharp_normal
2: particle_hit = ResourceManager.particle_hit_sharp_mid
3: particle_hit = ResourceManager.particle_hit_sharp_heavy
Enum.EDamageType.Blunt:
match break_level_sub:
-1: particle_hit = ResourceManager.particle_hit_blunt_block
0: particle_hit = ResourceManager.particle_hit_blunt_normal
1: particle_hit = ResourceManager.particle_hit_blunt_normal
2: particle_hit = ResourceManager.particle_hit_blunt_mid
3: particle_hit = ResourceManager.particle_hit_blunt_heavy
_: pass
if particle_hit:
character_to.cast_particle(particle_hit, false)
#受击材质特效
if (damage > 0) and (break_level_sub > 2):

@ -112,11 +112,11 @@ func update_move_check(delta):
normal += collision.get_normal()
normal = normal.normalized()
var normal_speed: float = velocity.dot(normal)
if normal_speed < -6:
if normal_speed < -6 and normal.y >= 0:
#墙体互动
Global.effect_mgr.cast_particle(ResourceManager.particle_hit_ground_heavy, character.pos(), normal)
var velocity_new = velocity - normal * normal_speed * 2
var attack_dir = Vector2(velocity_new.x, velocity_new.z).normalized()
var attack_dir = Vector2(velocity_new.x, velocity_new.z).normalized()
character.velocity = Vector3.ZERO
battle.add_attack(ResourceManager.cfg_attack_rebound, ResourceManager.cfg_attack_box_rebound, true, attack_dir)
elif normal_speed <-3:

@ -67,7 +67,7 @@ func check_action_pressed(key: String) -> bool:
"weapon_next": combo.weapon_index_change(1)
"test_1":
Global.character_mgr.create_character(ResourceManager.cfg_character_monster_test0, Enum.ETeam.Monster, character.pos())
# Global.effect_mgr.cast_particle(ResourceManager.particle_hit_ground_normal, character.pos(), Vector3.UP)
# Global.effect_mgr.cast_particle(ResourceManager.particle_hit_ground_heavy, character.pos(), Vector3.BACK)
_: return false
return true

@ -27,8 +27,14 @@ func _process(delta: float) -> void:
frame_time += delta
sprite3D.frame = int(frame_time / frame_rate) % frame_count
frame_time = fmod(frame_time, frame_time_all)
if move_and_slide():
var sub_particle: Node3D = sub.instantiate() as Node3D
SignalManager.effect_create.emit(sub_particle)
sub_particle.global_position = global_position
move_and_slide()
var collision_count: int = get_slide_collision_count()
if collision_count > 0:
if sub:
var normal: Vector3 = Vector3.ZERO
for i in collision_count:
var collision: KinematicCollision3D = get_slide_collision(i)
normal += collision.get_normal()
normal = normal.normalized()
Global.effect_mgr.cast_particle(sub, global_position, normal)
queue_free()

@ -5,13 +5,17 @@ class_name ParticleDecal
@export var gradient: Gradient
@export var scale_curve: Curve
@export var particle_rotate: int
@export var size_random: float #0-1 0为不随机 1为随机0~2倍
var lifetime_now: float
var size_scale: float
func on_ready() -> void:
var scale_sample: float = scale_curve.sample(0)
scale = Vector3(scale_sample, 1, scale_sample)
size_random = clamp(size_random, 0, 1)
size_scale = randf_range(1-size_random, 1+size_random)
scale = Vector3(scale_sample, 1, scale_sample) * size_scale
func on_process(delta: float) -> void:
@ -29,9 +33,8 @@ func on_process(delta: float) -> void:
#缩放曲线
if scale_curve:
var scale_sample: float = scale_curve.sample(rate)
scale = Vector3(scale_sample, 1, scale_sample)
scale = Vector3(scale_sample, 1, scale_sample) * size_scale
#旋转
rotation_degrees.y = particle_rotate * rate
return

@ -15,6 +15,6 @@ func cast_particle(resource: Resource, pos: Vector3, direction = Vector3.UP) ->
add_child(new_particle)
new_particle.position = pos
if direction.angle_to(Vector3.UP) > 0.01:
new_particle.look_at(pos + direction)
new_particle.look_at(pos - direction)
else:
new_particle.rotation.x = deg_to_rad(-90)

Loading…
Cancel
Save