Files
spellforge/scripts/domain/spell_system/projectile_def.gd
T
2026-07-20 10:56:52 +08:00

40 lines
1.3 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## ProjectileDef — 弹道生成参数描述
## ACTION 节点写入,SpellEvaluator 读取并调用 BulletManager.spawn_bullet
## 跨切片约束:reset() 必须重置 spawn_positionP6-N41
extends RefCounted
class_name ProjectileDef
var spawn_position: Vector2 = Vector2.ZERO # P6-N41: 必须在 reset() 中重置
var direction: Vector2 = Vector2.RIGHT
var speed: float = 300.0
var lifetime: float = 4.0
var radius: float = 6.0
var base_damage: float = 3.0
var damage_mult: float = 1.0
var damage_type: int = 0 # DamageType.PHYSICAL
var owner_id: int = 0
var source_tags: int = 0
var acceleration: float = 0.0
var on_hit_payload_id: int = -1 # -1 = 无触发
var pierce_remaining: int = 0
var bounce_remaining: int = 0
func reset() -> void:
spawn_position = Vector2.ZERO # P6-N41
direction = Vector2.RIGHT
speed = 300.0
lifetime = 4.0
radius = 6.0
base_damage = 3.0
damage_mult = 1.0
damage_type = 0
owner_id = 0
source_tags = 0
acceleration = 0.0
on_hit_payload_id = -1
pierce_remaining = 0
bounce_remaining = 0
func get_velocity() -> Vector2:
return direction.normalized() * speed