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/Contents/Wave.gd
T
fallingshrimp a572a77eda feat(游戏平衡): 调整敌人生成和子弹行为
- 将敌人数量增长逻辑移至GameRule并调整计算公式
- 修改鸡的攻击行为,子弹现在会朝向玩家发射
- 调整子弹伤害值和旋转动画
- 减少玩家初始苹果数量并增加敌人掉落苹果数量
- 修改BOSS出现波数为第8波
- 移除无用属性和优化代码结构
2025-08-28 07:45:50 +08:00

51 lines
1.3 KiB
GDScript

class_name Wave
var entity: PackedScene
var minCount: int = 1
var maxCount: int = 1
var isBoss: bool = false
var from: float = 0
var to: float = 0
var per: int = 0
static var current: int = 0
static var data: Array[Wave] = [
# entity, minCount, maxCount, isBoss, from, to, per
create(preload("res://components/Characters/Hen.tscn"), 1, 5, false, 0, INF, 1),
create(preload("res://components/Characters/Chick.tscn"), 0, 0, true, 8, INF, 4)
]
static func create(
entity_: PackedScene,
minCount_: int = 1,
maxCount_: int = 1,
isBoss_: bool = false,
from_: float = 0,
to_: float = 0,
per_: int = 0
) -> Wave:
var wave = Wave.new()
wave.entity = entity_
wave.minCount = minCount_
wave.maxCount = maxCount_
wave.isBoss = isBoss_
wave.from = from_
wave.to = to_
wave.per = per_
return wave
static func entityCountOf(wave: Wave) -> int:
if wave.from <= current and wave.to >= current and int(current - wave.from) % wave.per == 0:
if wave.isBoss:
return 1
else:
return randi_range(ceil(wave.minCount), floor(wave.maxCount * (1 + GameRule.entityCountBoostPerWave * current)))
return 0
static func spawn():
for i in range(len(data)):
var wave = data[i]
for j in range(entityCountOf(wave)):
EntityBase.generate(wave.entity, MathTool.randv2_range(500), true, wave.isBoss)
static func next():
spawn()
current += 1