mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(武器系统): 新增红水晶武器及相关资源
添加红水晶武器系统,包括武器、子弹、特效和音效资源 - 新增红水晶武器脚本及场景,实现爆炸伤害功能 - 添加红水晶子弹逻辑,支持半径爆炸效果 - 加入红水晶爆炸特效和音效 - 更新角色武器库包含红水晶武器 - 调整现有水晶武器描述和数值 - 扩展子弹基类支持首帧回调 - 更新特效控制器支持音效播放等待
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
extends BulletBase
|
||||
class_name RedCrystalBullet
|
||||
|
||||
var radius: float = 0
|
||||
|
||||
func register():
|
||||
hitbox.shape = hitbox.shape.duplicate()
|
||||
func ai():
|
||||
PresetBulletAI.forward(self, rotation)
|
||||
speed = (1 - lifeTimePercent()) * initialSpeed
|
||||
func destroy(_beacuseMap: bool):
|
||||
hitbox.shape.radius = radius
|
||||
EffectController.create(ComponentManager.getEffect("RedCrystalExplosion"), global_position).shot()
|
||||
await TickTool.millseconds(100)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bv848wj2ko0y0
|
||||
@@ -0,0 +1,15 @@
|
||||
@tool
|
||||
extends Weapon
|
||||
class_name RedCrystalWeapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 2 * to * soulLevel
|
||||
origin["radius"] += 4 * to * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
for bullet in BulletBase.generate(ComponentManager.getBullet("RedCrystal"), entity, weaponPos, (get_global_mouse_position() - weaponPos).angle()):
|
||||
if bullet is RedCrystalBullet:
|
||||
bullet.baseDamage = readStore("atk")
|
||||
bullet.radius = readStore("radius")
|
||||
return true
|
||||
@@ -0,0 +1 @@
|
||||
uid://dmsjasfucknxq
|
||||
@@ -36,6 +36,7 @@ var initialSpeed: float = 0
|
||||
var initialDamage: float = 0
|
||||
var speedScale: float = 1
|
||||
var parentScene: PackedScene = null
|
||||
var isFirstFrame: bool = true
|
||||
|
||||
func _ready():
|
||||
initialSpeed = speed
|
||||
@@ -85,6 +86,9 @@ func _physics_process(_delta: float) -> void:
|
||||
targetEntity.getTrackingAnchor(),
|
||||
launcher.fields.get(FieldStore.Entity.BULLET_TRACE) / 10
|
||||
)
|
||||
if isFirstFrame:
|
||||
firstFrame()
|
||||
isFirstFrame = false
|
||||
ai()
|
||||
else:
|
||||
tryDestroy()
|
||||
@@ -122,6 +126,8 @@ func timeLived():
|
||||
return WorldManager.getTime() - spawnInWhen
|
||||
func distanceLived():
|
||||
return position.distance_to(spawnInWhere)
|
||||
func lifeTimePercent():
|
||||
return timeLived() / lifeTime
|
||||
func lifeDistancePercent():
|
||||
return distanceLived() / lifeDistance
|
||||
func dotLoop():
|
||||
@@ -156,6 +162,8 @@ func tryRefract():
|
||||
refract(entity, i, total, last)
|
||||
|
||||
# 抽象方法
|
||||
func firstFrame():
|
||||
pass
|
||||
func ai():
|
||||
pass
|
||||
func destroy(_beacuseMap: bool):
|
||||
|
||||
@@ -24,6 +24,10 @@ func shot():
|
||||
if oneShot:
|
||||
await cloned.finished
|
||||
cloned.queue_free()
|
||||
if spawnSound:
|
||||
var sound: AudioStreamPlayer2D = sounds.get_node(spawnSound)
|
||||
if sound.playing:
|
||||
await sound.finished
|
||||
queue_free()
|
||||
|
||||
static func create(scene: PackedScene, spawnPosition: Vector2, parent: Node2D = null) -> EffectController:
|
||||
|
||||
Reference in New Issue
Block a user