战斗怪物死亡
This commit is contained in:
parent
3269a4c6a3
commit
b6cf77022b
@ -93,6 +93,7 @@ BattleConst.SPINE_ANIMATION_NAME = {
|
||||
ATTACK = "atk1",
|
||||
MOVE = "move",
|
||||
HIT = "hit",
|
||||
DEAD = "die",
|
||||
}
|
||||
|
||||
BattleConst.EFFECT_TYPE = {
|
||||
|
||||
@ -30,8 +30,8 @@ end
|
||||
|
||||
function BattleUnitComp:_initBase()
|
||||
self.isClear = false
|
||||
self.isDead = false
|
||||
self.isMove = false
|
||||
self.deadTime = 0
|
||||
self.attackTime = 0
|
||||
self.currAttackDuration = 0
|
||||
self.currAttackKeyTime = 0
|
||||
@ -103,7 +103,7 @@ function BattleUnitComp:changeState(state)
|
||||
if self.currState == state and not self:repeatCurrState() then
|
||||
return false
|
||||
end
|
||||
if self.isDead then -- 死亡后只能去死亡状态
|
||||
if self.currState == UNIT_STATE.DEAD then -- 死亡后只能去死亡状态
|
||||
if state ~= UNIT_STATE.DEAD then
|
||||
return false
|
||||
end
|
||||
@ -147,6 +147,27 @@ function BattleUnitComp:repeatCurrState()
|
||||
return false
|
||||
end
|
||||
|
||||
function BattleUnitComp:updateDead(dt)
|
||||
self.deadTime = self.deadTime - dt
|
||||
if self.deadTime <= 0 then
|
||||
self:clear()
|
||||
if self.deadOverCallback then
|
||||
local callback = self.deadOverCallback
|
||||
self.deadOverCallback = nil
|
||||
callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:exitDeadState()
|
||||
end
|
||||
|
||||
function BattleUnitComp:enterDeadState()
|
||||
local aniName = SPINE_ANIMATION_NAME.DEAD
|
||||
self.deadTime = self:getAnimationDuration(aniName) + 0.1
|
||||
self:playAnimation(aniName, false, false)
|
||||
end
|
||||
|
||||
function BattleUnitComp:exitIdleState()
|
||||
end
|
||||
|
||||
@ -376,11 +397,19 @@ function BattleUnitComp:showEffectNumber(num, x, y)
|
||||
self.battleController:showEffectNumber(num, x, y)
|
||||
end
|
||||
|
||||
function BattleUnitComp:playDead(callback)
|
||||
self.deadOverCallback = callback
|
||||
if not self:changeState(UNIT_STATE.DEAD) then
|
||||
self.deadOverCallback = nil
|
||||
callback()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:tick(dt)
|
||||
if self.isClear then
|
||||
return
|
||||
end
|
||||
if self.isDead then
|
||||
if self.currState == UNIT_STATE.DEAD then
|
||||
self:updateDead(dt)
|
||||
return
|
||||
end
|
||||
@ -395,4 +424,15 @@ function BattleUnitComp:tick(dt)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:getIsClear()
|
||||
return self.isClear
|
||||
end
|
||||
|
||||
function BattleUnitComp:clear()
|
||||
if self.isClear then
|
||||
return
|
||||
end
|
||||
self.isClear = true
|
||||
end
|
||||
|
||||
return BattleUnitComp
|
||||
@ -53,6 +53,9 @@ function BattleController:initDefUnits(callback)
|
||||
callback()
|
||||
end
|
||||
|
||||
function BattleController:findNextDefUnit()
|
||||
end
|
||||
|
||||
function BattleController:tick(dt)
|
||||
end
|
||||
|
||||
@ -133,6 +136,7 @@ function BattleController:init(params)
|
||||
self.battleData:init()
|
||||
BattleScheduler:init()
|
||||
BattleHelper:init()
|
||||
self:initOther()
|
||||
self:prepareFight()
|
||||
end
|
||||
|
||||
@ -276,7 +280,7 @@ function BattleController:enterAtkStepOver()
|
||||
|
||||
local defTeam = self.battleData:getDefTeam()
|
||||
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
|
||||
self:enterRefreshBoard()
|
||||
self:findNextDefUnit()
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@ -13,6 +13,10 @@ function BattleControllerStage:getMaxWave()
|
||||
return #chapterInfo.monster
|
||||
end
|
||||
|
||||
function BattleController:initOther()
|
||||
|
||||
end
|
||||
|
||||
function BattleControllerStage:initDefUnits(callback)
|
||||
local config = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||
local unitEntity = DataManager.BattleData:addMonster(config.monster[1])
|
||||
@ -74,6 +78,10 @@ function BattleControllerStage:getNotInvolvedSkills()
|
||||
return self.notInvolvedSkills
|
||||
end
|
||||
|
||||
function BattleControllerStage:findNextDefUnit()
|
||||
|
||||
end
|
||||
|
||||
function BattleControllerStage:controllBattleEnd()
|
||||
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user