背景移动
This commit is contained in:
parent
726e4af821
commit
7118b8790a
@ -514,6 +514,8 @@ function BattleUnitComp:enterEnterBattlefieldState()
|
||||
self.targetX = BattleConst.INIT_POS_X
|
||||
self.moveDirection = -1
|
||||
end
|
||||
local time = math.abs(self.targetX - self.positionX)/BattleConst.MOVE_SPEED
|
||||
self.battleController:moveBattlefield(time)
|
||||
else
|
||||
self:playAnimation(SPINE_ANIMATION_NAME.BORN, false, false)
|
||||
self.waitTime = self:getAnimationDuration(SPINE_ANIMATION_NAME.BORN)
|
||||
|
||||
@ -179,6 +179,10 @@ function BattleController:setIsPauseHpProgress(value)
|
||||
self.battleUI:setIsPauseHpProgress(value)
|
||||
end
|
||||
|
||||
function BattleController:moveBattlefield(time)
|
||||
self.battleUI:moveBattlefield(time)
|
||||
end
|
||||
|
||||
function BattleController:prepareFight()
|
||||
local count = 0
|
||||
local totalCount = 3
|
||||
|
||||
@ -66,6 +66,19 @@ function BattleUI:loadBg(bgName)
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:moveBattlefield(time)
|
||||
local width = self.bg:fastGetSizeDelta()
|
||||
self.bg:setAnchoredPositionX(width/4)
|
||||
if self.bgMoveTween == nil then
|
||||
self.bgMoveTween = self.bg:getTransform():DOAnchorPosX(-width/4, time)
|
||||
self.bgMoveTween:SetIntId(GConst.DOTWEEN_IDS.BATTLE)
|
||||
self.bgMoveTween:SetAutoKill(false)
|
||||
else
|
||||
self.bgMoveTween:ChangeEndValue(width*3/4, time, true)
|
||||
self.bgMoveTween:Restart()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUI:initSkill()
|
||||
if self.skillNodeCells then
|
||||
return
|
||||
@ -750,6 +763,10 @@ function BattleUI:clear()
|
||||
self.hpProgressYellowRightTween:Kill()
|
||||
self.hpProgressYellowRightTween = nil
|
||||
end
|
||||
if self.bgMoveTween then
|
||||
self.bgMoveTween:Kill()
|
||||
self.bgMoveTween = nil
|
||||
end
|
||||
if self.battleNumberNode then
|
||||
self.battleNumberNode:removeAllChildren()
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user