受击动画

This commit is contained in:
puxuan 2025-06-09 23:50:58 +08:00
parent c0237bd044
commit 3409aa046d
2 changed files with 17 additions and 1 deletions

View File

@ -732,7 +732,12 @@ function BattleUnitComp:playHurt()
if self.hurtAniNameCount <= 0 then if self.hurtAniNameCount <= 0 then
return return
end end
local name = self.hurtAniNameList[math.random(1, self.hurtAniNameCount)] local name = self.hurtNameList[1]
if not name then
name = self.hurtAniNameList[math.random(1, self.hurtAniNameCount)]
else
table.remove(self.hurtNameList, 1)
end
self.playSubAniTime = 0 self.playSubAniTime = 0
self.curHurtName = name self.curHurtName = name
if self.playSubAniDuration[name] == nil then if self.playSubAniDuration[name] == nil then
@ -1450,6 +1455,8 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx)
if isConditionPass then if isConditionPass then
self.team:addHurtComboTag(BattleConst.COMBO_DEFAULT_POSITION) self.team:addHurtComboTag(BattleConst.COMBO_DEFAULT_POSITION)
end end
-- 增加受击动画逻辑
target:setHurtList(skill:getHitNameList())
if self:takeEffect(effect, target, conditionResult) then if self:takeEffect(effect, target, conditionResult) then
if isConditionPass and skill:getComboPosition() then if isConditionPass and skill:getComboPosition() then
self.team:addHurtComboTag(skill:getComboPosition()) self.team:addHurtComboTag(skill:getComboPosition())
@ -2264,4 +2271,9 @@ function BattleUnitComp:recycle()
BattleHelper:recycleBattleHeroModel(self.modelId, self.baseObject) BattleHelper:recycleBattleHeroModel(self.modelId, self.baseObject)
end end
-- region
function BattleUnitComp:setHurtList(hurtNameList)
self.hurtNameList = table.refCopy(hurtNameList)
end
-- endregion
return BattleUnitComp return BattleUnitComp

View File

@ -461,4 +461,8 @@ function BattleSkillEntity:getIsHurtType()
return self.isHurtType return self.isHurtType
end end
function BattleSkillEntity:getHitNameList()
return self.skillInfo.name_hit or {}
end
return BattleSkillEntity return BattleSkillEntity