1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 23:11:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Statemachine/EffectController.gd
T
fallingshrimp e89e4f21e6 feat(武器系统): 添加核弹武器及相关资源
实现核弹武器功能,包括:
- 添加核弹控制器武器脚本和场景
- 实现核弹子弹逻辑和爆炸效果
- 添加相关图片、音效资源
- 更新角色武器库包含核弹
- 调整武器名称颜色配置
2025-09-20 22:17:09 +08:00

36 lines
996 B
GDScript

extends Node2D
class_name EffectController
@export var oneShot: bool = true
@export var spawnSound: String = ""
@export var spawnAnimation: String = ""
@onready var particles: GPUParticles2D = $"%particles"
@onready var sounds: Node2D = $"%sounds"
@onready var animator: AnimationPlayer = $"%animator"
func _ready():
particles.emitting = false
particles.one_shot = oneShot
var sound = sounds.get_node_or_null(spawnSound)
if sound and sound.stream:
sound.play()
if spawnAnimation:
animator.play(spawnAnimation)
func shot():
var cloned = particles.duplicate() as GPUParticles2D
cloned.emitting = true
add_child(cloned)
if oneShot:
await cloned.finished
cloned.queue_free()
static func create(scene: PackedScene, spawnPosition: Vector2, parent: Node2D = null) -> EffectController:
var cloned = scene.instantiate() as EffectController
cloned.global_position = spawnPosition
if parent:
parent.add_child(cloned)
else:
WorldManager.rootNode.add_child(cloned)
return cloned