战斗支持血量换皮肤
This commit is contained in:
parent
c11428b80b
commit
027809a5bd
@ -51,6 +51,13 @@ function CharacterSpineObject:refreshSkeletonDataAsset(dataAsset)
|
|||||||
self.characterSpineHelper:Reload()
|
self.characterSpineHelper:Reload()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function CharacterSpineObject:setSkin(skinName)
|
||||||
|
local skeletonGraphic = self:getSkeletonGraphic()
|
||||||
|
skeletonGraphic.initialSkinName = skinName
|
||||||
|
skeletonGraphic:Initialize(true)
|
||||||
|
self.characterSpineHelper:Reload()
|
||||||
|
end
|
||||||
|
|
||||||
function CharacterSpineObject:_genAllChildren()
|
function CharacterSpineObject:_genAllChildren()
|
||||||
local childMap = {}
|
local childMap = {}
|
||||||
if self.characterSpineHelper then
|
if self.characterSpineHelper then
|
||||||
|
|||||||
@ -694,6 +694,7 @@ function BattleUnitComp:exitIdleState()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:enterIdleState()
|
function BattleUnitComp:enterIdleState()
|
||||||
|
self:refreshHpSkin()
|
||||||
self:playAnimation(SPINE_ANIMATION_NAME.IDLE, true, false)
|
self:playAnimation(SPINE_ANIMATION_NAME.IDLE, true, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1698,6 +1699,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
|||||||
local delayTime = self.lastSameTimeHealCount * BattleConst.EFFECT_NUMBER_INTERVAL
|
local delayTime = self.lastSameTimeHealCount * BattleConst.EFFECT_NUMBER_INTERVAL
|
||||||
self:showEffectNumber(BattleConst.EFFECT_COLOR_GREEN, BattleConst.EFFECT_TYPE_BUFF, "+" .. num, x, y, delayTime)
|
self:showEffectNumber(BattleConst.EFFECT_COLOR_GREEN, BattleConst.EFFECT_TYPE_BUFF, "+" .. num, x, y, delayTime)
|
||||||
end
|
end
|
||||||
|
self:refreshHpSkin()
|
||||||
local hpPercent = self.unitEntity:getHpPercent()
|
local hpPercent = self.unitEntity:getHpPercent()
|
||||||
self.battleController:refreshHp(self.side, hp, hpPercent)
|
self.battleController:refreshHp(self.side, hp, hpPercent)
|
||||||
if not atker:getIsFinalBlock() or atker:getIsCentralizedAttack() then
|
if not atker:getIsFinalBlock() or atker:getIsCentralizedAttack() then
|
||||||
@ -1743,6 +1745,25 @@ function BattleUnitComp:showEffectNumber(colorType, effectType, num, x, y, delay
|
|||||||
self.battleController:showEffectNumber(colorType, effectType, num, x, y + addY, delayTime, showCombo)
|
self.battleController:showEffectNumber(colorType, effectType, num, x, y + addY, delayTime, showCombo)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitComp:refreshHpSkin()
|
||||||
|
if self.unitEntity:getHpSkinInfo() then
|
||||||
|
local skin
|
||||||
|
local hpp = self.unitEntity:getHpPercent() * DEFAULT_FACTOR
|
||||||
|
for index, info in ipairs(self.unitEntity:getHpSkinInfo()) do
|
||||||
|
if hpp <= info.hpp then
|
||||||
|
skin = info.skin
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.lastHpSkin == skin then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.lastHpSkin = skin
|
||||||
|
Logger.logHighlight(skin)
|
||||||
|
self.baseObject:setSkin(skin)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitComp:playDead(callback)
|
function BattleUnitComp:playDead(callback)
|
||||||
self.deadOverCallback = callback
|
self.deadOverCallback = callback
|
||||||
if self:getIsClear() then
|
if self:getIsClear() then
|
||||||
|
|||||||
@ -658,6 +658,8 @@ function BattleData:addMonster(monsterId, newTeam, battleController)
|
|||||||
isBoss = monsterInfo.is_boss,
|
isBoss = monsterInfo.is_boss,
|
||||||
exp = monsterInfo.monster_exp or 0,
|
exp = monsterInfo.monster_exp or 0,
|
||||||
body = monsterInfo.body,
|
body = monsterInfo.body,
|
||||||
|
hpSkinHp = monsterInfo.monster_hp,
|
||||||
|
hpSkinSkin = monsterInfo.monster_hp_skin,
|
||||||
attr = {
|
attr = {
|
||||||
hp = hp,
|
hp = hp,
|
||||||
max_hp = hp,
|
max_hp = hp,
|
||||||
|
|||||||
@ -12,6 +12,7 @@ function BattleUnitEntity:init(unitData, side, team)
|
|||||||
self.damageCount = 0 -- 记录伤害
|
self.damageCount = 0 -- 记录伤害
|
||||||
self.healCount = 0 -- 记录治疗
|
self.healCount = 0 -- 记录治疗
|
||||||
self.activeSkillReleaseCount = 0 -- 记录主动技能释放次数
|
self.activeSkillReleaseCount = 0 -- 记录主动技能释放次数
|
||||||
|
self.hpSkinInfo = nil
|
||||||
self:initSkill()
|
self:initSkill()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -429,6 +430,25 @@ function BattleUnitEntity:getAttrValue(attr)
|
|||||||
return self.team:getAttrValue(attr)
|
return self.team:getAttrValue(attr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitEntity:getHpSkinInfo()
|
||||||
|
if not self.hpSkinInfo then
|
||||||
|
if self.unitData.hpSkinHp and self.unitData.hpSkinSkin then
|
||||||
|
self.hpSkinInfo = {}
|
||||||
|
for index, v in pairs(self.unitData.hpSkinHp) do
|
||||||
|
local skin = self.unitData.hpSkinSkin[index]
|
||||||
|
if not skin then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
table.insert(self.hpSkinInfo, {hpp = v, skin = skin})
|
||||||
|
end
|
||||||
|
table.sort(self.hpSkinInfo, function(a, b)
|
||||||
|
return a.hpp < b.hpp
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self.hpSkinInfo
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitEntity:addSkillExtraUseTimes(skillId, count)
|
function BattleUnitEntity:addSkillExtraUseTimes(skillId, count)
|
||||||
if self.skillExtraUseTimes == nil then
|
if self.skillExtraUseTimes == nil then
|
||||||
self.skillExtraUseTimes = {}
|
self.skillExtraUseTimes = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user