关键伤害帧
This commit is contained in:
parent
ad150a5e08
commit
d0399fe460
@ -202,6 +202,13 @@ function CharacterSpineObject:getAnimationDuration(animationName)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function CharacterSpineObject:getAnimationKeyFrameTime(animationName)
|
||||||
|
if self.characterSpineHelper then
|
||||||
|
return self.characterSpineHelper:GetAnimationKeyFrameTime(animationName)
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
function CharacterSpineObject:addAnimationCompleteCallback(callback)
|
function CharacterSpineObject:addAnimationCompleteCallback(callback)
|
||||||
if self._animationStateCompleteCallback then
|
if self._animationStateCompleteCallback then
|
||||||
return
|
return
|
||||||
|
|||||||
@ -59,6 +59,7 @@ function BattleUnitComp:_initBase()
|
|||||||
self.switchTime = 0
|
self.switchTime = 0
|
||||||
self.isPlayHurt = 0
|
self.isPlayHurt = 0
|
||||||
self.attackDurationMap = {}
|
self.attackDurationMap = {}
|
||||||
|
self.attackKeyFrameTimeMap = {}
|
||||||
self.shieldBuffList = {}
|
self.shieldBuffList = {}
|
||||||
self.activeSkillIndex = nil
|
self.activeSkillIndex = nil
|
||||||
self.currActiveSkill = nil
|
self.currActiveSkill = nil
|
||||||
@ -106,6 +107,18 @@ function BattleUnitComp:getAnimationDuration(aniName)
|
|||||||
return duration or 0
|
return duration or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitComp:getAnimationKeyFrameTime(animationName)
|
||||||
|
local time = self.attackKeyFrameTimeMap[animationName]
|
||||||
|
if time == nil then
|
||||||
|
time = self.baseObject:getAnimationKeyFrameTime(animationName)
|
||||||
|
if time <= 0 then -- 容错处理
|
||||||
|
time = 0.3
|
||||||
|
end
|
||||||
|
self.attackKeyFrameTimeMap[animationName] = time
|
||||||
|
end
|
||||||
|
return time
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitComp:useAssistingSkill(count, callback)
|
function BattleUnitComp:useAssistingSkill(count, callback)
|
||||||
local skill = self.unitEntity:getAssistingSkill()
|
local skill = self.unitEntity:getAssistingSkill()
|
||||||
if skill == nil then
|
if skill == nil then
|
||||||
@ -379,11 +392,11 @@ function BattleUnitComp:enterAssistingAttackState()
|
|||||||
self.attackOver = false
|
self.attackOver = false
|
||||||
self.attackTime = 0
|
self.attackTime = 0
|
||||||
self.isMove = false
|
self.isMove = false
|
||||||
self.currAttackKeyTime = 0.3
|
|
||||||
local skill = self.unitEntity:getAssistingSkill()
|
local skill = self.unitEntity:getAssistingSkill()
|
||||||
skill:startUse()
|
skill:startUse()
|
||||||
local attackName = skill:getSkillAttackName()
|
local attackName = skill:getSkillAttackName()
|
||||||
self.currAttackDuration = self:getAnimationDuration(attackName)
|
self.currAttackDuration = self:getAnimationDuration(attackName)
|
||||||
|
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
|
||||||
self:playAnimation(attackName, false, false)
|
self:playAnimation(attackName, false, false)
|
||||||
self:initPosition()
|
self:initPosition()
|
||||||
end
|
end
|
||||||
@ -415,7 +428,6 @@ end
|
|||||||
function BattleUnitComp:enterSkillAttackState()
|
function BattleUnitComp:enterSkillAttackState()
|
||||||
self.attackOver = false
|
self.attackOver = false
|
||||||
self.attackTime = 0
|
self.attackTime = 0
|
||||||
self.currAttackKeyTime = 0.3
|
|
||||||
self.targetX = nil
|
self.targetX = nil
|
||||||
local skill
|
local skill
|
||||||
if self.normalSkillCount > 0 then
|
if self.normalSkillCount > 0 then
|
||||||
@ -445,6 +457,7 @@ function BattleUnitComp:enterSkillAttackState()
|
|||||||
attackName = skill:getSkillAttackName()
|
attackName = skill:getSkillAttackName()
|
||||||
end
|
end
|
||||||
self.currAttackDuration = self:getAnimationDuration(attackName)
|
self.currAttackDuration = self:getAnimationDuration(attackName)
|
||||||
|
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
|
||||||
self:playAnimation(attackName, false, false)
|
self:playAnimation(attackName, false, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -552,24 +565,23 @@ end
|
|||||||
|
|
||||||
function BattleUnitComp:doNextSkillAttack()
|
function BattleUnitComp:doNextSkillAttack()
|
||||||
self.attackTime = 0
|
self.attackTime = 0
|
||||||
self.currAttackKeyTime = 0.3
|
|
||||||
local attackName = self.currActiveSkill:getSkillAttackName()
|
local attackName = self.currActiveSkill:getSkillAttackName()
|
||||||
self.currAttackDuration = self:getAnimationDuration(attackName)
|
self.currAttackDuration = self:getAnimationDuration(attackName)
|
||||||
|
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
|
||||||
self:playAnimation(attackName, false, false)
|
self:playAnimation(attackName, false, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:doNextNormalAttack()
|
function BattleUnitComp:doNextNormalAttack()
|
||||||
self.attackTime = 0
|
self.attackTime = 0
|
||||||
self.currAttackKeyTime = 0.3
|
|
||||||
local skill = self.unitEntity:getNormalSkill()
|
local skill = self.unitEntity:getNormalSkill()
|
||||||
local attackName = skill:getRandomNormalAttackName()
|
local attackName = skill:getRandomNormalAttackName()
|
||||||
self.currAttackDuration = self:getAnimationDuration(attackName)
|
self.currAttackDuration = self:getAnimationDuration(attackName)
|
||||||
|
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
|
||||||
self:playAnimation(attackName, false, false)
|
self:playAnimation(attackName, false, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:doNextAttack()
|
function BattleUnitComp:doNextAttack()
|
||||||
self.attackTime = 0
|
self.attackTime = 0
|
||||||
self.currAttackKeyTime = 0.3
|
|
||||||
local attackName = nil
|
local attackName = nil
|
||||||
if self.normalSkillCount > 0 then
|
if self.normalSkillCount > 0 then
|
||||||
local skill = self.unitEntity:getNormalSkill()
|
local skill = self.unitEntity:getNormalSkill()
|
||||||
@ -579,6 +591,7 @@ function BattleUnitComp:doNextAttack()
|
|||||||
end
|
end
|
||||||
if attackName then
|
if attackName then
|
||||||
self.currAttackDuration = self:getAnimationDuration(attackName)
|
self.currAttackDuration = self:getAnimationDuration(attackName)
|
||||||
|
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
|
||||||
self:playAnimation(attackName, false, false)
|
self:playAnimation(attackName, false, false)
|
||||||
else -- 归位
|
else -- 归位
|
||||||
self:moveBackToInitPosition()
|
self:moveBackToInitPosition()
|
||||||
@ -588,7 +601,6 @@ end
|
|||||||
function BattleUnitComp:enterNormalAttackState()
|
function BattleUnitComp:enterNormalAttackState()
|
||||||
self.attackOver = false
|
self.attackOver = false
|
||||||
self.attackTime = 0
|
self.attackTime = 0
|
||||||
self.currAttackKeyTime = 0.3
|
|
||||||
local skill = self.unitEntity:getNormalSkill()
|
local skill = self.unitEntity:getNormalSkill()
|
||||||
skill:startUse()
|
skill:startUse()
|
||||||
if skill:getMoveType() == BattleConst.SKILL_MOVE_TYPE.MOVE then
|
if skill:getMoveType() == BattleConst.SKILL_MOVE_TYPE.MOVE then
|
||||||
@ -607,6 +619,7 @@ function BattleUnitComp:enterNormalAttackState()
|
|||||||
self.attackTime = 0
|
self.attackTime = 0
|
||||||
local attackName = skill:getRandomNormalAttackName()
|
local attackName = skill:getRandomNormalAttackName()
|
||||||
self.currAttackDuration = self:getAnimationDuration(attackName)
|
self.currAttackDuration = self:getAnimationDuration(attackName)
|
||||||
|
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
|
||||||
self:playAnimation(attackName, false, false)
|
self:playAnimation(attackName, false, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user