mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
refactor(Characters/Rooster): 调整子弹折射和分裂参数
移除子弹分裂参数,将子弹折射次数从2增加到3 更新武器从ChainGun到PurpleCrystal 优化子弹折射逻辑,避免重复目标 使用call_deferred安全添加子节点
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_e5pl8"]
|
||||
[ext_resource type="Script" uid="uid://cthtupc6dtbav" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dlaks67h2osms" path="res://components/Weapons/ChainGun.tscn" id="3_s7kxe"]
|
||||
[ext_resource type="PackedScene" uid="uid://c0n3igy4hucrg" path="res://components/Weapons/PurpleCrystal.tscn" id="3_s7kxe"]
|
||||
[ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="4_66s6c"]
|
||||
[ext_resource type="AudioStream" uid="uid://benyec5bqni0b" path="res://resources/sounds/effect/Chomp.wav" id="4_k0yme"]
|
||||
[ext_resource type="AudioStream" uid="uid://dmxh3bpk8vyy5" path="res://resources/sounds/effect/Coin.mp3" id="5_xnbhq"]
|
||||
@@ -54,7 +54,8 @@ metadata/_edit_vertical_guides_ = [71.0]
|
||||
[node name="weaponStore" parent="." index="1"]
|
||||
process_mode = 4
|
||||
|
||||
[node name="ChainGun" parent="weaponStore" index="0" instance=ExtResource("3_s7kxe")]
|
||||
[node name="PurpleCrystal" parent="weaponStore" index="0" instance=ExtResource("3_s7kxe")]
|
||||
debugRebuild = false
|
||||
|
||||
[node name="sprint" parent="sounds" index="0"]
|
||||
stream = ExtResource("4_66s6c")
|
||||
|
||||
@@ -12,8 +12,7 @@ func register():
|
||||
EffectController.create(ComponentManager.getEffect("BloodFall"), texture.global_position).shot()
|
||||
)
|
||||
if !WorldManager.isRelease():
|
||||
fields[FieldStore.Entity.BULLET_SPLIT] = 2
|
||||
fields[FieldStore.Entity.BULLET_REFRACTION] = 2
|
||||
fields[FieldStore.Entity.BULLET_REFRACTION] = 3
|
||||
func ai():
|
||||
texture.play("walk")
|
||||
var direction = Vector2(
|
||||
|
||||
@@ -152,19 +152,30 @@ func trySplit():
|
||||
var cloned = duplicate() as BulletBase
|
||||
cloned.rotation = deg_to_rad(360.0 / total * i)
|
||||
cloned.isChildSplit = true
|
||||
get_parent().add_child(split(cloned, i, total, last))
|
||||
cloned.launcher = launcher
|
||||
cloned.parent = parent
|
||||
get_parent().add_child.call_deferred(split(cloned, i, total, last))
|
||||
func tryRefract():
|
||||
if is_instance_valid(launcher) and !isChildRefract:
|
||||
var value = launcher.fields.get(FieldStore.Entity.BULLET_REFRACTION)
|
||||
var total = MathTool.shrimpRate(value)
|
||||
var last = value - floor(value)
|
||||
var aimed: Array[EntityBase] = []
|
||||
for i in total:
|
||||
var entity = EntityTool.findClosetEntity(position, get_tree(), !launcher.isPlayer(), launcher.isPlayer(), [launcher])
|
||||
var entity = EntityTool.findClosetEntity(
|
||||
position, get_tree(),
|
||||
!launcher.isPlayer(),
|
||||
launcher.isPlayer(),
|
||||
[launcher] + aimed
|
||||
)
|
||||
if is_instance_valid(entity):
|
||||
aimed.append(entity)
|
||||
var cloned = duplicate() as BulletBase
|
||||
cloned.look_at(entity.position)
|
||||
cloned.isChildRefract = true
|
||||
get_parent().add_child(refract(cloned, entity, i, total, last))
|
||||
cloned.launcher = launcher
|
||||
cloned.parent = parent
|
||||
get_parent().add_child.call_deferred(refract(cloned, entity, i, total, last))
|
||||
|
||||
# 抽象方法
|
||||
func firstFrame():
|
||||
|
||||
@@ -8,7 +8,7 @@ static func fromHurtbox(node: Node) -> EntityBase:
|
||||
if entity is EntityBase:
|
||||
return entity as EntityBase
|
||||
return null
|
||||
static func findClosetEntity(to: Vector2, fromTree: SceneTree, player: bool = false, mob: bool = false, excludes: Array[EntityBase] = [], allowSummon: bool = false) -> EntityBase:
|
||||
static func findClosetEntity(to: Vector2, fromTree: SceneTree, player: bool = false, mob: bool = false, excludes: Array = [], allowSummon: bool = false) -> EntityBase:
|
||||
var result = null
|
||||
var lastDistance = INF
|
||||
var nodes = []
|
||||
|
||||
Reference in New Issue
Block a user