feat: implement explosive and homing projectile types for weapon system
This commit is contained in:
@@ -68,3 +68,25 @@ func _explode(pos: Vector3) -> void:
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
col.take_damage(final_damage, target_pos, owner_player)
|
col.take_damage(final_damage, target_pos, owner_player)
|
||||||
|
|
||||||
|
# Visual Effect
|
||||||
|
var visual = MeshInstance3D.new()
|
||||||
|
var s_mesh = SphereMesh.new()
|
||||||
|
s_mesh.radius = explosion_radius
|
||||||
|
s_mesh.height = explosion_radius * 2.0
|
||||||
|
visual.mesh = s_mesh
|
||||||
|
|
||||||
|
var mat = StandardMaterial3D.new()
|
||||||
|
mat.albedo_color = Color(1.0, 0.5, 0.0, 0.6) # Translucent orange
|
||||||
|
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
|
||||||
|
mat.emission_enabled = true
|
||||||
|
mat.emission = Color(1.0, 0.3, 0.0)
|
||||||
|
visual.material_override = mat
|
||||||
|
|
||||||
|
visual.position = pos
|
||||||
|
get_tree().current_scene.add_child(visual)
|
||||||
|
|
||||||
|
var tween = visual.create_tween()
|
||||||
|
tween.tween_property(mat, "albedo_color:a", 0.0, 0.3)
|
||||||
|
tween.parallel().tween_property(visual, "scale", Vector3(1.1, 1.1, 1.1), 0.3)
|
||||||
|
tween.tween_callback(visual.queue_free)
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ var turn_speed: float = 5.0
|
|||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if is_instance_valid(weapon_source) and weapon_source.get("homing_target_pos") != null:
|
if is_instance_valid(weapon_source) and weapon_source.get("homing_target_pos") != null:
|
||||||
|
var is_painting = weapon_source.get("is_targeting")
|
||||||
|
if is_painting != null and not is_painting:
|
||||||
|
# Not painting target, just fly straight
|
||||||
|
pass
|
||||||
|
else:
|
||||||
var target: Vector3 = weapon_source.homing_target_pos
|
var target: Vector3 = weapon_source.homing_target_pos
|
||||||
if target != Vector3.ZERO:
|
if target != Vector3.ZERO:
|
||||||
# Steer towards target
|
# Steer towards target
|
||||||
|
|||||||
Reference in New Issue
Block a user