耐力模块初步完善

This commit is contained in:
UnKownOwO
2022-11-28 22:14:07 +08:00
parent 362ca86130
commit 3cd8a32818
10 changed files with 211 additions and 7 deletions

View File

@@ -31,6 +31,9 @@ func (t *TickManager) OnGameServerTick() {
t.tickCount++
now := time.Now().UnixMilli()
t.onTick100MilliSecond(now)
if t.tickCount%2 == 0 {
t.onTick200MilliSecond(now)
}
if t.tickCount%(10*1) == 0 {
t.onTickSecond(now)
}
@@ -222,6 +225,15 @@ func (t *TickManager) onTickSecond(now int64) {
}
}
func (t *TickManager) onTick200MilliSecond(now int64) {
// 耐力消耗
for _, world := range t.gameManager.worldManager.worldMap {
for _, player := range world.playerMap {
t.gameManager.StaminaHandler(player)
}
}
}
func (t *TickManager) onTick100MilliSecond(now int64) {
// 伤害处理和转发
for _, world := range t.gameManager.worldManager.worldMap {