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