更新敌人效果

This commit is contained in:
小李xl 2024-04-11 01:49:40 +08:00
parent f84219d421
commit 575281a1fa
27 changed files with 370 additions and 79 deletions

View File

@ -1,11 +1,10 @@
[gd_scene load_steps=12 format=3 uid="uid://cjgnw37tqiqh7"] [gd_scene load_steps=12 format=3 uid="uid://cjgnw37tqiqh7"]
[ext_resource type="Script" path="res://src/game/activity/bullet/normal/BrushBullet.cs" id="1_13wdl"] [ext_resource type="Script" path="res://src/game/activity/bullet/normal/Bullet.cs" id="1_lpj81"]
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="2_v0al6"] [ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="2_v0al6"]
[ext_resource type="SpriteFrames" uid="uid://jj8oh76pi53j" path="res://resource/spriteFrames/bullet/Bullet0005.tres" id="3_mmvqn"] [ext_resource type="SpriteFrames" uid="uid://jj8oh76pi53j" path="res://resource/spriteFrames/bullet/Bullet0005.tres" id="3_mmvqn"]
[ext_resource type="Texture2D" uid="uid://h7hkgbwj1li" path="res://resource/sprite/common/Smoke.png" id="4_esjg6"] [ext_resource type="Texture2D" uid="uid://h7hkgbwj1li" path="res://resource/sprite/common/Smoke.png" id="4_esjg6"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_v77gw"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_v77gw"]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("2_v0al6") shader = ExtResource("2_v0al6")
@ -65,12 +64,10 @@ anim_offset_max = 1.0
collision_layer = 2 collision_layer = 2
collision_mask = 0 collision_mask = 0
platform_wall_layers = 512 platform_wall_layers = 512
script = ExtResource("1_13wdl") script = ExtResource("1_lpj81")
BrushId = "0004"
EffectiveAltitude = 1.0
CollisionArea = NodePath("AnimatedSprite/CollisionArea") CollisionArea = NodePath("AnimatedSprite/CollisionArea")
CollisionShape2D = NodePath("AnimatedSprite/CollisionArea/CollisionShape2D") CollisionShape2D = NodePath("AnimatedSprite/CollisionArea/CollisionShape2D")
Particles2D = [NodePath("AnimatedSprite/GPUParticles2D")] Particles2D = []
ShadowSprite = NodePath("ShadowSprite") ShadowSprite = NodePath("ShadowSprite")
AnimatedSprite = NodePath("AnimatedSprite") AnimatedSprite = NodePath("AnimatedSprite")
Collision = NodePath("Collision") Collision = NodePath("Collision")

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://m0s0k5nw7nbi"] [gd_scene load_steps=5 format=3 uid="uid://m0s0k5nw7nbi"]
[ext_resource type="Material" uid="uid://c1chld6lkpgji" path="res://resource/material/SmokeParticleMaterial.tres" id="1_leomh"] [ext_resource type="Material" uid="uid://c1chld6lkpgji" path="res://resource/material/SmokeParticleMaterial.tres" id="1_leomh"]
[ext_resource type="Texture2D" uid="uid://h7hkgbwj1li" path="res://resource/sprite/effects/common/Smoke.png" id="2_c2t2e"] [ext_resource type="Texture2D" uid="uid://h7hkgbwj1li" path="res://resource/sprite/common/Smoke.png" id="2_c2t2e"]
[ext_resource type="Script" path="res://src/game/effects/AutoDestroyParticles.cs" id="3_5cpi6"] [ext_resource type="Script" path="res://src/game/effects/AutoDestroyParticles.cs" id="3_5cpi6"]
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_emuda"] [sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_emuda"]
@ -11,7 +11,6 @@ particles_anim_v_frames = 1
particles_anim_loop = false particles_anim_loop = false
[node name="EnemyBloodEffect" type="GPUParticles2D" node_paths=PackedStringArray("Particles2D")] [node name="EnemyBloodEffect" type="GPUParticles2D" node_paths=PackedStringArray("Particles2D")]
modulate = Color(0.811765, 0.0980392, 0.0980392, 0.627451)
material = SubResource("CanvasItemMaterial_emuda") material = SubResource("CanvasItemMaterial_emuda")
emitting = false emitting = false
amount = 10 amount = 10

View File

@ -3,6 +3,21 @@
[ext_resource type="Texture2D" uid="uid://nbwtavmsjps6" path="res://resource/sprite/role/dle_liquid/enemy0001_Icon_liquid.png" id="1_ite3h"] [ext_resource type="Texture2D" uid="uid://nbwtavmsjps6" path="res://resource/sprite/role/dle_liquid/enemy0001_Icon_liquid.png" id="1_ite3h"]
[ext_resource type="Script" path="res://src/game/effects/enemy/EnemyBlood0002.cs" id="2_uof3e"] [ext_resource type="Script" path="res://src/game/effects/enemy/EnemyBlood0002.cs" id="2_uof3e"]
[sub_resource type="Animation" id="Animation_p16al"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(2.08165e-12, 2.08165e-12, 20, 48)]
}
[sub_resource type="Animation" id="Animation_rir6a"] [sub_resource type="Animation" id="Animation_rir6a"]
resource_name = "default" resource_name = "default"
length = 0.2 length = 0.2
@ -34,21 +49,6 @@ tracks/1/keys = {
}] }]
} }
[sub_resource type="Animation" id="Animation_p16al"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(2.08165e-12, 2.08165e-12, 20, 48)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_f1xdh"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_f1xdh"]
_data = { _data = {
"RESET": SubResource("Animation_p16al"), "RESET": SubResource("Animation_p16al"),
@ -56,6 +56,7 @@ _data = {
} }
[node name="EnemyBlood0002" type="Sprite2D"] [node name="EnemyBlood0002" type="Sprite2D"]
modulate = Color(0.992157, 0.788235, 0.788235, 1)
texture = ExtResource("1_ite3h") texture = ExtResource("1_ite3h")
centered = false centered = false
offset = Vector2(-16, -24) offset = Vector2(-16, -24)

View File

@ -177,7 +177,7 @@ gravity = Vector3(0, 0, 0)
scale_min = 0.4 scale_min = 0.4
scale_max = 1.5 scale_max = 1.5
scale_curve = SubResource("CurveTexture_rutlp") scale_curve = SubResource("CurveTexture_rutlp")
color = Color(0.811765, 0.0980392, 0.0980392, 0.627451) color = Color(0.992157, 0.788235, 0.788235, 0.627451)
color_ramp = SubResource("GradientTexture1D_orgu0") color_ramp = SubResource("GradientTexture1D_orgu0")
anim_offset_max = 1.0 anim_offset_max = 1.0

View File

@ -1,11 +1,10 @@
[gd_scene load_steps=19 format=3 uid="uid://nfx3lhkdhv6a"] [gd_scene load_steps=19 format=3 uid="uid://nfx3lhkdhv6a"]
[ext_resource type="Script" path="res://src/game/effects/enemy/EnemyDead0002.cs" id="1_ghu6a"] [ext_resource type="Script" path="res://src/game/activity/common/AutoFreezeObject.cs" id="1_pcn20"]
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="2_q163q"] [ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="2_q163q"]
[ext_resource type="Texture2D" uid="uid://x3tjqgdgp43n" path="res://resource/sprite/role/enemy0002/Enemy0002_dead.png" id="3_l0kbp"] [ext_resource type="Texture2D" uid="uid://x3tjqgdgp43n" path="res://resource/sprite/role/enemy0002/Enemy0002_dead.png" id="3_l0kbp"]
[ext_resource type="Texture2D" uid="uid://h7hkgbwj1li" path="res://resource/sprite/common/Smoke.png" id="4_2wygu"] [ext_resource type="Texture2D" uid="uid://h7hkgbwj1li" path="res://resource/sprite/common/Smoke.png" id="4_2wygu"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_s1mj2"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_s1mj2"]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("2_q163q") shader = ExtResource("2_q163q")
@ -101,7 +100,7 @@ anim_offset_max = 1.0
[node name="Effect0002" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")] [node name="Effect0002" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")]
collision_layer = 128 collision_layer = 128
script = ExtResource("1_ghu6a") script = ExtResource("1_pcn20")
AnimationName = "dead" AnimationName = "dead"
AutoToGrey = true AutoToGrey = true
ShadowSprite = NodePath("ShadowSprite") ShadowSprite = NodePath("ShadowSprite")

View File

@ -1 +1 @@
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[{"Position":{"X":-81,"Y":25},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":31,"Y":32},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0004","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0003","CurrAmmon":"12","ResidueAmmo":"12"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":-54,"Y":20},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":5.551115E-14}]}]]}] [{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[{"Position":{"X":-81,"Y":25},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":31,"Y":32},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0004","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0003","CurrAmmon":"12","ResidueAmmo":"12"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":-54,"Y":20},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":5.551115E-14}]},{"Position":{"X":81,"Y":-1},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0002","Weight":100,"Attr":{"Face":"0","Weapon":null},"Altitude":0,"VerticalSpeed":5.551115E-14}]}]]}]

View File

@ -17,5 +17,6 @@ gravity = Vector3(0, 0, 0)
scale_min = 0.8 scale_min = 0.8
scale_max = 0.8 scale_max = 0.8
scale_curve = ExtResource("1_yr5l8") scale_curve = ExtResource("1_yr5l8")
color = Color(0.992157, 0.788235, 0.788235, 0.627451)
color_ramp = SubResource("GradientTexture1D_4mhw0") color_ramp = SubResource("GradientTexture1D_4mhw0")
anim_offset_max = 1.0 anim_offset_max = 1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 B

After

Width:  |  Height:  |  Size: 83 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d3mgv0utmax42"
path="res://.godot/imported/enemy0001.png-bd4a7798d07cd5f254c33ccbfead77f4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/sprite/role/enemy0002/enemy0001.png"
dest_files=["res://.godot/imported/enemy0001.png-bd4a7798d07cd5f254c33ccbfead77f4.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cxwjdbql5m2v0"
path="res://.godot/imported/enemy0005_Icon.png-2897ecc50529bab5d0643e849e41cf6f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/sprite/role/enemy0006/enemy0005_Icon.png"
dest_files=["res://.godot/imported/enemy0005_Icon.png-2897ecc50529bab5d0643e849e41cf6f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cm43ngrboceyr"
path="res://.godot/imported/enemy0006_Debris.png-d1fbf79bad5aefa7d37040e3a6e8db7d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/sprite/role/enemy0006/enemy0006_Debris.png"
dest_files=["res://.godot/imported/enemy0006_Debris.png-d1fbf79bad5aefa7d37040e3a6e8db7d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cwpffv2oan6cy"
path="res://.godot/imported/dle.png-79145da0f375bf73578bd141d00d2ce8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/sprite/role/enemy0007/dle.png"
dest_files=["res://.godot/imported/dle.png-79145da0f375bf73578bd141d00d2ce8.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b7hkqotixfp6c"
path="res://.godot/imported/enemy0005_Icon.png-0a336b66135db16c8e2f50cd4c955d4e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/sprite/role/enemy0007/enemy0005_Icon.png"
dest_files=["res://.godot/imported/enemy0005_Icon.png-0a336b66135db16c8e2f50cd4c955d4e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://l8k0hb6v4os3"
path="res://.godot/imported/enemy0006_Debris.png-8d79cda8586b6b07126be2733324473d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/sprite/role/enemy0007/enemy0006_Debris.png"
dest_files=["res://.godot/imported/enemy0006_Debris.png-8d79cda8586b6b07126be2733324473d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://cw702ostmv2am" uid="uid://cw702ostmv2am"
path="res://.godot/imported/Role0001_head.png-9e4bb55990b7b54630895db4565f621f.ctex" path="res://.godot/imported/Role0002_head.png-0fc4e9cd8c6dfbfc2886c02f9a6156a8.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://resource/sprite/role/role0001/Role0001_head.png" source_file="res://resource/sprite/role/role0002/Role0002_head.png"
dest_files=["res://.godot/imported/Role0001_head.png-9e4bb55990b7b54630895db4565f621f.ctex"] dest_files=["res://.godot/imported/Role0002_head.png-0fc4e9cd8c6dfbfc2886c02f9a6156a8.ctex"]
[params] [params]

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dkqlpt32fo6or"
path="res://.godot/imported/eat.png-e1ed219f030d4904026f5a118b10ffbc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/sprite/role/role0002/eat/eat.png"
dest_files=["res://.godot/imported/eat.png-e1ed219f030d4904026f5a118b10ffbc.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c6q6mg6qf516t"
path="res://.godot/imported/idle.png-9ab7c522bba3fc742b6cace13ceaedde.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/sprite/role/role0002/idle/idle.png"
dest_files=["res://.godot/imported/idle.png-9ab7c522bba3fc742b6cace13ceaedde.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://00fayflq13rs"
path="res://.godot/imported/Sprite.png-bf7f6826c7373e1221a0a5e7a76364b1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/sprite/role/role0002/run/Sprite.png"
dest_files=["res://.godot/imported/Sprite.png-bf7f6826c7373e1221a0a5e7a76364b1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -44,6 +44,7 @@ public partial class ImageCanvas : Sprite2D, IDestroy
/// 将指定纹理添加到预渲染队列中, 完成后会调用 onDrawingComplete 回调函数 /// 将指定纹理添加到预渲染队列中, 完成后会调用 onDrawingComplete 回调函数
/// </summary> /// </summary>
/// <param name="texture">需要渲染的纹理</param> /// <param name="texture">需要渲染的纹理</param>
/// <param name="modulate">混色</param>
/// <param name="material">渲染材质, 不需要则传null</param> /// <param name="material">渲染材质, 不需要则传null</param>
/// <param name="x">离画布左上角x坐标</param> /// <param name="x">离画布左上角x坐标</param>
/// <param name="y">离画布左上角y坐标</param> /// <param name="y">离画布左上角y坐标</param>
@ -52,17 +53,18 @@ public partial class ImageCanvas : Sprite2D, IDestroy
/// <param name="centerY">旋转中心点y</param> /// <param name="centerY">旋转中心点y</param>
/// <param name="flipY">是否翻转y轴</param> /// <param name="flipY">是否翻转y轴</param>
/// <param name="onDrawingComplete">绘制完成的回调函数</param> /// <param name="onDrawingComplete">绘制完成的回调函数</param>
public void DrawImageInCanvas(Texture2D texture, Material material, float x, float y, float angle, int centerX, int centerY, bool flipY, Action onDrawingComplete = null) public void DrawImageInCanvas(Texture2D texture, Color modulate, Material material, float x, float y, float angle, int centerX, int centerY, bool flipY, Action onDrawingComplete = null)
{ {
DrawImageInCanvas(texture, material, x, y, angle, centerX, centerY, flipY, true, onDrawingComplete); DrawImageInCanvas(texture,modulate, material, x, y, angle, centerX, centerY, flipY, true, onDrawingComplete);
} }
private void DrawImageInCanvas(Texture2D texture, Material material, float x, float y, float angle, int centerX, int centerY, bool flipY, bool enableQueueCutting, Action onDrawingComplete) private void DrawImageInCanvas(Texture2D texture, Color modulate, Material material, float x, float y, float angle, int centerX, int centerY, bool flipY, bool enableQueueCutting, Action onDrawingComplete)
{ {
var item = new ImageRenderData(); var item = new ImageRenderData();
item.OnDrawingComplete = onDrawingComplete; item.OnDrawingComplete = onDrawingComplete;
item.EnableQueueCutting = enableQueueCutting; item.EnableQueueCutting = enableQueueCutting;
item.ImageCanvas = this; item.ImageCanvas = this;
item.SrcImage = texture.GetImage(); item.SrcImage = texture.GetImage();
item.Modulate = modulate;
item.Material = material; item.Material = material;
var width = item.SrcImage.GetWidth(); var width = item.SrcImage.GetWidth();
var height = item.SrcImage.GetHeight(); var height = item.SrcImage.GetHeight();
@ -165,7 +167,7 @@ public partial class ImageCanvas : Sprite2D, IDestroy
} }
DrawImageInCanvas( DrawImageInCanvas(
shadowSprite.Texture, shadowSprite.Material, shadowSprite.Texture, shadowSprite.Modulate, shadowSprite.Material,
ax + activityObject.ShadowOffset.X, ay + activityObject.ShadowOffset.Y, ax + activityObject.ShadowOffset.X, ay + activityObject.ShadowOffset.Y,
angle, angle,
centerX, centerY, flipY, centerX, centerY, flipY,
@ -187,7 +189,7 @@ public partial class ImageCanvas : Sprite2D, IDestroy
} }
//为了保证阴影在此之前渲染, 所以必须关闭插队渲染 //为了保证阴影在此之前渲染, 所以必须关闭插队渲染
DrawImageInCanvas( DrawImageInCanvas(
texture, animatedSprite.Material, texture, animatedSprite.Modulate, animatedSprite.Material,
ax, ay, ax, ay,
animatedSprite.GlobalRotationDegrees, animatedSprite.GlobalRotationDegrees,
centerX, centerY, flipY, centerX, centerY, flipY,

View File

@ -323,6 +323,7 @@ public partial class ImageCanvas
} }
} }
renderSprite.Sprite.Modulate = item.Modulate;
renderSprite.Sprite.Material = item.Material; renderSprite.Sprite.Material = item.Material;
renderSprite.Sprite.Offset = new Vector2(-item.CenterX, -item.CenterY); renderSprite.Sprite.Offset = new Vector2(-item.CenterX, -item.CenterY);

View File

@ -14,6 +14,10 @@ public class ImageRenderData
/// </summary> /// </summary>
public Image SrcImage; public Image SrcImage;
/// <summary> /// <summary>
/// 颜色
/// </summary>
public Color Modulate { get; set; }
/// <summary>
/// 渲染材质 /// 渲染材质
/// </summary> /// </summary>
public Material Material; public Material Material;

View File

@ -69,7 +69,7 @@ public partial class BoomBullet : Bullet
var texture = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_explode_Explode_pit0001_png); var texture = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_explode_Explode_pit0001_png);
var tempPos = AffiliationArea.RoomInfo.ToCanvasPosition(pos); var tempPos = AffiliationArea.RoomInfo.ToCanvasPosition(pos);
AffiliationArea.RoomInfo.StaticImageCanvas.DrawImageInCanvas( AffiliationArea.RoomInfo.StaticImageCanvas.DrawImageInCanvas(
texture, null, tempPos.X, tempPos.Y, Utils.Random.RandomRangeInt(0, 360), texture, Colors.White, null, tempPos.X, tempPos.Y, Utils.Random.RandomRangeInt(0, 360),
texture.GetWidth() / 2, texture.GetHeight() / 2, false texture.GetWidth() / 2, texture.GetHeight() / 2, false
); );
} }

View File

@ -8,7 +8,7 @@ using Godot;
[Tool] [Tool]
public partial class NoWeaponEnemy : Enemy public partial class NoWeaponEnemy : Enemy
{ {
private BrushImageData _brushData; //private BrushImageData _brushData;
public override void OnInit() public override void OnInit()
{ {
@ -17,16 +17,16 @@ public partial class NoWeaponEnemy : Enemy
WeaponPack.SetCapacity(0); WeaponPack.SetCapacity(0);
AnimationPlayer.AnimationFinished += OnAnimationFinished; AnimationPlayer.AnimationFinished += OnAnimationFinished;
_brushData = LiquidBrushManager.GetBrush("0002"); //_brushData = LiquidBrushManager.GetBrush("0002");
} }
protected override void Process(float delta) // protected override void Process(float delta)
{ // {
base.Process(delta); // base.Process(delta);
//
//测试笔刷 // //测试笔刷
DrawLiquid(_brushData); // //DrawLiquid(_brushData);
} // }
public override void Attack() public override void Attack()
{ {
@ -68,7 +68,7 @@ public partial class NoWeaponEnemy : Enemy
{ {
var realVelocity = GetRealVelocity(); var realVelocity = GetRealVelocity();
var effPos = Position; var effPos = Position;
var debris = Create<EnemyDead0002>(Ids.Id_enemy_dead0002); var debris = Create<AutoFreezeObject>(Ids.Id_enemy_dead0002);
debris.PutDown(effPos, RoomLayerEnum.NormalLayer); debris.PutDown(effPos, RoomLayerEnum.NormalLayer);
debris.MoveController.AddForce(Velocity + realVelocity); debris.MoveController.AddForce(Velocity + realVelocity);
debris.SetForwardDirection(Face); debris.SetForwardDirection(Face);

View File

@ -13,10 +13,10 @@ public partial class EnemyBlood0002 : Sprite2D
private void DoDestory() private void DoDestory()
{ {
var position = _roomInfo.ToCanvasPosition(GlobalPosition); var position = _roomInfo.ToCanvasPosition(GlobalPosition);
_roomInfo.StaticImageCanvas.DrawImageInCanvas(Texture, null, position.X, position.Y, RotationDegrees, _roomInfo.StaticImageCanvas.DrawImageInCanvas(Texture, Modulate, null, position.X, position.Y, RotationDegrees,
(int)-Offset.X, (int)-Offset.Y, false, () => (int)-Offset.X, (int)-Offset.Y, false, () =>
{ {
QueueFree(); QueueFree();
}); });
} }
} }

View File

@ -1,29 +0,0 @@

using Godot;
[Tool]
public partial class EnemyDead0002 : AutoFreezeObject
{
private BrushImageData _brushData;
public override void OnInit()
{
base.OnInit();
_brushData = LiquidBrushManager.GetBrush("0002");
}
protected override void Process(float delta)
{
base.Process(delta);
//测试笔刷
if (FreezeCount == 0)
{
DrawLiquid(_brushData);
}
else
{
BrushPrevPosition = null;
}
}
}

View File

@ -381,6 +381,10 @@ public class ResourcePath
public const string resource_sprite_role_scarecrow0001_png = "res://resource/sprite/role/scarecrow0001.png"; public const string resource_sprite_role_scarecrow0001_png = "res://resource/sprite/role/scarecrow0001.png";
public const string resource_sprite_role_role8_png = "res://resource/sprite/role/role8.png"; public const string resource_sprite_role_role8_png = "res://resource/sprite/role/role8.png";
public const string resource_sprite_role_role9_png = "res://resource/sprite/role/role9.png"; public const string resource_sprite_role_role9_png = "res://resource/sprite/role/role9.png";
public const string resource_sprite_role_role0002_Role0002_head_png = "res://resource/sprite/role/role0002/Role0002_head.png";
public const string resource_sprite_role_role0002_idle_idle_png = "res://resource/sprite/role/role0002/idle/idle.png";
public const string resource_sprite_role_role0002_eat_eat_png = "res://resource/sprite/role/role0002/eat/eat.png";
public const string resource_sprite_role_role0002_run_Sprite_png = "res://resource/sprite/role/role0002/run/Sprite.png";
public const string resource_sprite_role_shopBoss0001_ShopBoss0001_png = "res://resource/sprite/role/shopBoss0001/ShopBoss0001.png"; public const string resource_sprite_role_shopBoss0001_ShopBoss0001_png = "res://resource/sprite/role/shopBoss0001/ShopBoss0001.png";
public const string resource_sprite_role_enemy0003_enemy0003_png = "res://resource/sprite/role/enemy0003/enemy0003.png"; public const string resource_sprite_role_enemy0003_enemy0003_png = "res://resource/sprite/role/enemy0003/enemy0003.png";
public const string resource_sprite_role_enemy0003_enemy0003_Icon_png = "res://resource/sprite/role/enemy0003/enemy0003_Icon.png"; public const string resource_sprite_role_enemy0003_enemy0003_Icon_png = "res://resource/sprite/role/enemy0003/enemy0003_Icon.png";
@ -393,6 +397,7 @@ public class ResourcePath
public const string resource_sprite_role_enemy0005_enemy0005_png = "res://resource/sprite/role/enemy0005/enemy0005.png"; public const string resource_sprite_role_enemy0005_enemy0005_png = "res://resource/sprite/role/enemy0005/enemy0005.png";
public const string resource_sprite_role_enemy0005_enemy0005_Debris_png = "res://resource/sprite/role/enemy0005/enemy0005_Debris.png"; public const string resource_sprite_role_enemy0005_enemy0005_Debris_png = "res://resource/sprite/role/enemy0005/enemy0005_Debris.png";
public const string resource_sprite_role_enemy0005_enemy0005_Icon_png = "res://resource/sprite/role/enemy0005/enemy0005_Icon.png"; public const string resource_sprite_role_enemy0005_enemy0005_Icon_png = "res://resource/sprite/role/enemy0005/enemy0005_Icon.png";
public const string resource_sprite_role_enemy0002_enemy0001_png = "res://resource/sprite/role/enemy0002/enemy0001.png";
public const string resource_sprite_role_enemy0002_Enemy0002_png = "res://resource/sprite/role/enemy0002/Enemy0002.png"; public const string resource_sprite_role_enemy0002_Enemy0002_png = "res://resource/sprite/role/enemy0002/Enemy0002.png";
public const string resource_sprite_role_enemy0002_Enemy0002_dead_png = "res://resource/sprite/role/enemy0002/Enemy0002_dead.png"; public const string resource_sprite_role_enemy0002_Enemy0002_dead_png = "res://resource/sprite/role/enemy0002/Enemy0002_dead.png";
public const string resource_sprite_role_enemy0002_Enemy0002_attack_png = "res://resource/sprite/role/enemy0002/Enemy0002_attack.png"; public const string resource_sprite_role_enemy0002_Enemy0002_attack_png = "res://resource/sprite/role/enemy0002/Enemy0002_attack.png";
@ -446,10 +451,15 @@ public class ResourcePath
public const string resource_sprite_role_common_Role_shadow1_png = "res://resource/sprite/role/common/Role_shadow1.png"; public const string resource_sprite_role_common_Role_shadow1_png = "res://resource/sprite/role/common/Role_shadow1.png";
public const string resource_sprite_role_common_Role_notify_png = "res://resource/sprite/role/common/Role_notify.png"; public const string resource_sprite_role_common_Role_notify_png = "res://resource/sprite/role/common/Role_notify.png";
public const string resource_sprite_role_enemy0007_enemy005_png = "res://resource/sprite/role/enemy0007/enemy005.png"; public const string resource_sprite_role_enemy0007_enemy005_png = "res://resource/sprite/role/enemy0007/enemy005.png";
public const string resource_sprite_role_enemy0007_enemy0006_Debris_png = "res://resource/sprite/role/enemy0007/enemy0006_Debris.png";
public const string resource_sprite_role_enemy0007_enemy0005_Icon_png = "res://resource/sprite/role/enemy0007/enemy0005_Icon.png";
public const string resource_sprite_role_enemy0007_dle_png = "res://resource/sprite/role/enemy0007/dle.png";
public const string resource_sprite_role_enemy0001_enemy0001_png = "res://resource/sprite/role/enemy0001/enemy0001.png"; public const string resource_sprite_role_enemy0001_enemy0001_png = "res://resource/sprite/role/enemy0001/enemy0001.png";
public const string resource_sprite_role_enemy0001_enemy0001_Icon副本_png = "res://resource/sprite/role/enemy0001/enemy0001_Icon - 副本.png"; public const string resource_sprite_role_enemy0001_enemy0001_Icon副本_png = "res://resource/sprite/role/enemy0001/enemy0001_Icon - 副本.png";
public const string resource_sprite_role_enemy0001_enemy0001_Debris_png = "res://resource/sprite/role/enemy0001/enemy0001_Debris.png"; public const string resource_sprite_role_enemy0001_enemy0001_Debris_png = "res://resource/sprite/role/enemy0001/enemy0001_Debris.png";
public const string resource_sprite_role_enemy0006_enemy0005_png = "res://resource/sprite/role/enemy0006/enemy0005.png"; public const string resource_sprite_role_enemy0006_enemy0005_png = "res://resource/sprite/role/enemy0006/enemy0005.png";
public const string resource_sprite_role_enemy0006_enemy0006_Debris_png = "res://resource/sprite/role/enemy0006/enemy0006_Debris.png";
public const string resource_sprite_role_enemy0006_enemy0005_Icon_png = "res://resource/sprite/role/enemy0006/enemy0005_Icon.png";
public const string resource_sprite_box_TreasureBox0001_icon_png = "res://resource/sprite/box/TreasureBox0001_icon.png"; public const string resource_sprite_box_TreasureBox0001_icon_png = "res://resource/sprite/box/TreasureBox0001_icon.png";
public const string resource_sprite_box_TreasureBox0001_png = "res://resource/sprite/box/TreasureBox0001.png"; public const string resource_sprite_box_TreasureBox0001_png = "res://resource/sprite/box/TreasureBox0001.png";
public const string resource_sprite_shootFire_ShotFire0001_png = "res://resource/sprite/shootFire/ShotFire0001.png"; public const string resource_sprite_shootFire_ShotFire0001_png = "res://resource/sprite/shootFire/ShotFire0001.png";

View File

@ -25,7 +25,7 @@ public partial class TestOptimizeSprite : Node2D
var centerX = Utils.Random.RandomRangeInt(0, texture.GetWidth()); var centerX = Utils.Random.RandomRangeInt(0, texture.GetWidth());
var centerY = Utils.Random.RandomRangeInt(0, texture.GetHeight()); var centerY = Utils.Random.RandomRangeInt(0, texture.GetHeight());
var angle = Utils.Random.RandomRangeInt(0, 360); var angle = Utils.Random.RandomRangeInt(0, 360);
imageCanvas.DrawImageInCanvas(texture, null, x, y, imageCanvas.DrawImageInCanvas(texture, Colors.White, null, x, y,
angle, centerX, centerY, Utils.Random.RandomBoolean(), angle, centerX, centerY, Utils.Random.RandomBoolean(),
() => () =>
{ {