【战斗】优化身外化身casting显示时间

dev_chengFeng
gaoxin 2021-12-14 13:51:41 +08:00
parent 82ced48859
commit 1691fd03da
3 changed files with 27 additions and 11 deletions

View File

@ -35,6 +35,14 @@ end
--++++++++++++++DelayFunc 延迟执行方法 --++++++++++++++DelayFunc 延迟执行方法
function BattleUnit:DelayFunc(time, func) function BattleUnit:DelayFunc(time, func)
-- 判断是否需要延时
if not time or time <= 0 then
if func then
func()
end
return
end
--
if not self._DelayFuncList then if not self._DelayFuncList then
self._DelayFuncList = {} self._DelayFuncList = {}
end end

View File

@ -144,9 +144,6 @@ end
-- 播放动画 -- 播放动画
function MonsterView:PlaySpineAnim(gog, time, name, isLoop) function MonsterView:PlaySpineAnim(gog, time, name, isLoop)
if self.isMainPlayer then
name = "idle"
end
if isLoop then if isLoop then
gog.AnimationState:SetAnimation(time, name, isLoop) gog.AnimationState:SetAnimation(time, name, isLoop)
else else
@ -262,8 +259,15 @@ function MonsterView:OnSkillCastingStart(skill)
coroutine.wait(0.1) coroutine.wait(0.1)
self.turnEffect:SetActive(true) self.turnEffect:SetActive(true)
end) end)
-- 延长Casting时间
return 0.6
else else
self:PlaySpineAnim(self.RoleLiveGOGraphic2, 0, "attack" , false) if self.isMainPlayer then
self:PlaySpineAnim(self.RoleLiveGOGraphic2, 0, "idle" , false)
else
self:PlaySpineAnim(self.RoleLiveGOGraphic2, 0, "attack" , false)
end
end end

View File

@ -135,17 +135,21 @@ function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
self.owner:OnSkillCastStart(skill) self.owner:OnSkillCastStart(skill)
end end
-- 调用上层接口 -- 调用上层接口
local _ExtraTime
if self.owner.OnSkillCastingStart then if self.owner.OnSkillCastingStart then
self.owner:OnSkillCastingStart() _ExtraTime = self.owner:OnSkillCastingStart()
end end
_ExtraTime = _ExtraTime or 0
self.owner:DelayFunc(2, function() self.owner:DelayFunc(2, function()
self.castingEfectNode:SetActive(false) -- 判断是否要额外增加casting显示时间
self.owner:DelayFunc(_ExtraTime, function ()
-- 调用上层接口 self.castingEfectNode:SetActive(false)
if self.owner.OnSkillCastingEnd then -- 调用上层接口
self.owner:OnSkillCastingEnd() if self.owner.OnSkillCastingEnd then
end self.owner:OnSkillCastingEnd()
end
end)
if func then func() func = nil end if func then func() func = nil end
end) end)