入场表现
This commit is contained in:
parent
904a57760d
commit
f7b2b736f8
@ -47,6 +47,10 @@ function BattleUnitComp:getMatchType()
|
||||
return self.unitEntity:getMatchType()
|
||||
end
|
||||
|
||||
function BattleUnitComp:getIsBoss()
|
||||
return self.unitEntity:getIsBoss()
|
||||
end
|
||||
|
||||
function BattleUnitComp:setTeam(team)
|
||||
self.team = team
|
||||
end
|
||||
@ -188,6 +192,14 @@ function BattleUnitComp:hideOutsideScreen()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:playRunAction()
|
||||
self:playAnimation(SPINE_ANIMATION_NAME.MOVE, true)
|
||||
end
|
||||
|
||||
function BattleUnitComp:stopRunAction()
|
||||
self:playAnimation(SPINE_ANIMATION_NAME.IDLE, true)
|
||||
end
|
||||
|
||||
function BattleUnitComp:playAnimation(name, loop, forceRefresh)
|
||||
if name == SPINE_ANIMATION_NAME.HIT then
|
||||
self.isPlayHurt = 1
|
||||
@ -457,6 +469,11 @@ function BattleUnitComp:updateEnterBattlefieldState(dt)
|
||||
self:changeState(UNIT_STATE.IDLE)
|
||||
end
|
||||
self.baseObject:setLocalPosition(self.positionX, 0, 0)
|
||||
else
|
||||
self.waitTime = self.waitTime - dt
|
||||
if self.waitTime < 0 then
|
||||
self:changeState(UNIT_STATE.IDLE)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -469,9 +486,8 @@ function BattleUnitComp:exitEnterBattlefieldState()
|
||||
end
|
||||
|
||||
function BattleUnitComp:enterEnterBattlefieldState()
|
||||
self:hideOutsideScreen()
|
||||
self.isMove = true
|
||||
self:playAnimation(SPINE_ANIMATION_NAME.BORN, true, false)
|
||||
if self.isMove then
|
||||
self:playAnimation(SPINE_ANIMATION_NAME.IDLE, true, false)
|
||||
self.positionX = self.baseObject:fastGetLocalPosition()
|
||||
if self.side == BattleConst.SIDE_ATK then
|
||||
self.targetX = -BattleConst.INIT_POS_X
|
||||
@ -480,6 +496,10 @@ function BattleUnitComp:enterEnterBattlefieldState()
|
||||
self.targetX = BattleConst.INIT_POS_X
|
||||
self.moveDirection = -1
|
||||
end
|
||||
else
|
||||
self:playAnimation(SPINE_ANIMATION_NAME.BORN, false, false)
|
||||
self.waitTime = self:getAnimationDuration(SPINE_ANIMATION_NAME.BORN)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:exitIdleState()
|
||||
@ -982,13 +1002,27 @@ function BattleUnitComp:playDead(callback)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:playEnterBattlefield(callback)
|
||||
function BattleUnitComp:playEnterBattlefield(isBoss, callback)
|
||||
self.finishEnterBattlefieldCallback = callback
|
||||
if isBoss then
|
||||
self.isMove = true
|
||||
self:hideOutsideScreen()
|
||||
if not self:changeState(UNIT_STATE.ENTER_BATTLEFIELD) then
|
||||
self.finishEnterBattlefieldCallback = nil
|
||||
self.isMove = false
|
||||
self:initPosition()
|
||||
self:changeState(UNIT_STATE.IDLE)
|
||||
callback()
|
||||
end
|
||||
else
|
||||
self.isMove = false
|
||||
self:initPosition()
|
||||
if not self:changeState(UNIT_STATE.ENTER_BATTLEFIELD) then
|
||||
self.finishEnterBattlefieldCallback = nil
|
||||
self:changeState(UNIT_STATE.IDLE)
|
||||
callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:onRoundEnd()
|
||||
|
||||
@ -31,6 +31,7 @@ function BattleControllerStage:initDefUnits(callback)
|
||||
end
|
||||
|
||||
function BattleControllerStage:_stageGenerateNextMonster()
|
||||
local isBoss = self.defTeam:getIsBoss()
|
||||
local config = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||
local unitEntity = DataManager.BattleData:addMonster(config.monster[self.waveIndex], true)
|
||||
local modelId = unitEntity:getModelId()
|
||||
@ -39,11 +40,20 @@ function BattleControllerStage:_stageGenerateNextMonster()
|
||||
local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT)
|
||||
monsterComp:initWithEntity(modelId, unitEntity, self)
|
||||
self.defTeam:addUnit(monsterComp, true)
|
||||
monsterComp:playEnterBattlefield(function()
|
||||
self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent())
|
||||
if isBoss then -- 如果是boss就跑过去
|
||||
self.atkTeam:playRunAction()
|
||||
monsterComp:playEnterBattlefield(true, function()
|
||||
self.atkTeam:stopRunAction()
|
||||
self:enterNextWave()
|
||||
self:enterRefreshBoard()
|
||||
end)
|
||||
self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent())
|
||||
else
|
||||
monsterComp:playEnterBattlefield(false, function()
|
||||
self:enterNextWave()
|
||||
self:enterRefreshBoard()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@ -202,6 +202,25 @@ function BattleTeam:getUnitComp()
|
||||
return self.unitMap
|
||||
end
|
||||
|
||||
function BattleTeam:getIsBoss()
|
||||
if self.mainUnit == nil then
|
||||
return false
|
||||
end
|
||||
return self.mainUnit:getIsBoss()
|
||||
end
|
||||
|
||||
function BattleTeam:playRunAction()
|
||||
if self.mainUnit then
|
||||
self.mainUnit:playRunAction()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleTeam:stopRunAction()
|
||||
if self.mainUnit then
|
||||
self.mainUnit:stopRunAction()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleTeam:tick(dt)
|
||||
for k, v in ipairs(self.unitList) do
|
||||
v:tick(dt)
|
||||
|
||||
@ -187,6 +187,10 @@ function BattleTeamEntity:removeLimit(name)
|
||||
self.limitAll = self.limitAll - 1
|
||||
end
|
||||
|
||||
function BattleTeamEntity:getIsLimit()
|
||||
return self.limitAll > 0
|
||||
end
|
||||
|
||||
function BattleTeamEntity:addShield(num)
|
||||
self.shieldHp = self.shieldHp + num
|
||||
end
|
||||
|
||||
@ -225,6 +225,10 @@ function BattleUnitEntity:removeLimit(name)
|
||||
self.team:removeLimit(name)
|
||||
end
|
||||
|
||||
function BattleUnitEntity:getIsLimit()
|
||||
return self.team:getIsLimit()
|
||||
end
|
||||
|
||||
function BattleUnitEntity:addShield(num)
|
||||
self.team:addShield(num)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user