diff --git a/DungeonShooting_Godot/resource/material/Blend.gdshader b/DungeonShooting_Godot/resource/material/Blend.gdshader index a40db2f..f83601b 100644 --- a/DungeonShooting_Godot/resource/material/Blend.gdshader +++ b/DungeonShooting_Godot/resource/material/Blend.gdshader @@ -21,6 +21,7 @@ void fragment() { //显示轮廓 if (show_outline) { + vec4 color = texture(TEXTURE, UV); vec2 size = TEXTURE_PIXEL_SIZE; float outline; outline = texture(TEXTURE, UV + vec2(-size.x, 0)).a; @@ -29,18 +30,19 @@ outline += texture(TEXTURE, UV + vec2(0, -size.y)).a; outline = min(outline, 1.0); - vec4 animated_line_color = vec4( - light_offset + sin(2.0 * 3.14 * frequency * TIME), - light_offset + sin(2.0 * 3.14 * frequency * TIME + radians(120.0)), - light_offset + sin(2.0 * 3.14 * frequency * TIME + radians(240.0)), - 1.0 - ); - - vec4 color = texture(TEXTURE, UV); - if (outline_rainbow){ - COLOR = mix(color, animated_line_color, outline - color.a); - } else { - COLOR = mix(color, outline_color , outline - color.a); + if (color.a == 0.0 && outline > 0.0) { + vec4 animated_line_color = vec4( + light_offset + sin(2.0 * 3.14 * frequency * TIME), + light_offset + sin(2.0 * 3.14 * frequency * TIME + radians(120.0)), + light_offset + sin(2.0 * 3.14 * frequency * TIME + radians(240.0)), + 1.0 + ); + + if (outline_rainbow){ + COLOR = mix(color, animated_line_color, 1); + } else { + COLOR = mix(color, outline_color , 1); + } } } diff --git a/DungeonShooting_Godot/resource/sprite/bullet/bullet0001.png b/DungeonShooting_Godot/resource/sprite/bullet/bullet0001.png index fb6ccea..afa441e 100644 --- a/DungeonShooting_Godot/resource/sprite/bullet/bullet0001.png +++ b/DungeonShooting_Godot/resource/sprite/bullet/bullet0001.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/bullet/bullet0002.png b/DungeonShooting_Godot/resource/sprite/bullet/bullet0002.png index ce0577e..fc38c20 100644 --- a/DungeonShooting_Godot/resource/sprite/bullet/bullet0002.png +++ b/DungeonShooting_Godot/resource/sprite/bullet/bullet0002.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/bullet/bullet0003.png b/DungeonShooting_Godot/resource/sprite/bullet/bullet0003.png index 6478bfa..cbda060 100644 --- a/DungeonShooting_Godot/resource/sprite/bullet/bullet0003.png +++ b/DungeonShooting_Godot/resource/sprite/bullet/bullet0003.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/bullet/bullet2.png b/DungeonShooting_Godot/resource/sprite/bullet/bullet2.png index 3cea799..964f292 100644 --- a/DungeonShooting_Godot/resource/sprite/bullet/bullet2.png +++ b/DungeonShooting_Godot/resource/sprite/bullet/bullet2.png Binary files differ diff --git a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs index bfba9fb..743708a 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs @@ -51,7 +51,7 @@ /// 位置 /// 角度 /// 攻击目标层级 - public void Init(Role trigger,Weapon weapon, float speed, float maxDistance, Vector2 position, float rotation, uint targetLayer) + public void Init(Role trigger, Weapon weapon, float speed, float maxDistance, Vector2 position, float rotation, uint targetLayer) { Weapon = weapon; Role = weapon.Master; @@ -71,8 +71,14 @@ Position = position; Rotation = rotation; ShadowOffset = new Vector2(0, 5); - BasisVelocity = new Vector2(FlySpeed, 0).Rotated(Rotation); + + //如果子弹会对玩家造成伤害, 则显示红色描边 + if (Player.Current.CollisionWithMask(targetLayer)) + { + ShowOutline = true; + OutlineColor = new Color(1, 0, 0, 0.9f); + } } protected override void PhysicsProcessOver(float delta)