diff --git a/scripts/Contents/Bullets/VectorStar.gd b/scripts/Contents/Bullets/VectorStar.gd index c2bc497..56a2c3a 100644 --- a/scripts/Contents/Bullets/VectorStar.gd +++ b/scripts/Contents/Bullets/VectorStar.gd @@ -19,6 +19,8 @@ func ai(): func split(newBullet: BulletBase, _index: int, _total: int, _lastBullet: float): if newBullet is VectorStar: newBullet.forwarded = false + return newBullet func refract(newBullet: BulletBase, _entity: EntityBase, _index: int, _total: int, _lastBullet: float): if newBullet is VectorStar: newBullet.forwarded = false + return newBullet diff --git a/scripts/Contents/Characters/Rooster.gd b/scripts/Contents/Characters/Rooster.gd index 067ce1c..2d09656 100644 --- a/scripts/Contents/Characters/Rooster.gd +++ b/scripts/Contents/Characters/Rooster.gd @@ -11,6 +11,9 @@ func register(): elif bullet is FoxZhua: EffectController.create(ComponentManager.getEffect("BloodFall"), texture.global_position).shot() ) + if !WorldManager.isRelease(): + fields[FieldStore.Entity.BULLET_SPLIT] = 2 + fields[FieldStore.Entity.BULLET_REFRACTION] = 2 func ai(): texture.play("walk") var direction = Vector2( diff --git a/scripts/Statemachine/BulletBase.gd b/scripts/Statemachine/BulletBase.gd index 437fa72..39d62c0 100644 --- a/scripts/Statemachine/BulletBase.gd +++ b/scripts/Statemachine/BulletBase.gd @@ -152,7 +152,7 @@ func trySplit(): var cloned = duplicate() as BulletBase cloned.rotation = deg_to_rad(360.0 / total * i) cloned.isChildSplit = true - split(cloned, i, total, last) + get_parent().add_child(split(cloned, i, total, last)) func tryRefract(): if is_instance_valid(launcher) and !isChildRefract: var value = launcher.fields.get(FieldStore.Entity.BULLET_REFRACTION) @@ -164,7 +164,7 @@ func tryRefract(): var cloned = duplicate() as BulletBase cloned.look_at(entity.position) cloned.isChildRefract = true - refract(cloned, entity, i, total, last) + get_parent().add_child(refract(cloned, entity, i, total, last)) # 抽象方法 func firstFrame(): @@ -181,10 +181,10 @@ func succeedToHit(_dmg: float, _entity: EntityBase): pass func register(): pass -func split(_newBullet: BulletBase, _index: int, _total: int, _lastBullet: float): - pass -func refract(_newBullet: BulletBase, _entity: EntityBase, _index: int, _total: int, _lastBullet: float): - pass +func split(newBullet: BulletBase, _index: int, _total: int, _lastBullet: float): + return newBullet +func refract(newBullet: BulletBase, _entity: EntityBase, _index: int, _total: int, _lastBullet: float): + return newBullet static func generate( bullet: PackedScene,