[战斗]======表现修改 如果正在释放技能不会播放受击动画

dev_chengFeng
wangzhenxing 2021-12-07 16:33:04 +08:00
parent acbd814a89
commit 3b1ba253b5
2 changed files with 62 additions and 37 deletions

View File

@ -141,7 +141,7 @@ function EnemyView:onCreate(go, role, position, root, isBoss,enemyId)
self.rageSlider.fillAmount = self.role.Rage / 4 self.rageSlider.fillAmount = self.role.Rage / 4
self.rageText.gameObject:SetActive(false) self.rageText.gameObject:SetActive(false)
self.rageText.text = "" self.rageText.text = ""
self.currAniName="idle"
-- 伤害文字显示 -- 伤害文字显示
self.LastBuffFloatingTime = Time.realtimeSinceStartup self.LastBuffFloatingTime = Time.realtimeSinceStartup
self.BuffFloatingCount = 0 self.BuffFloatingCount = 0
@ -362,18 +362,23 @@ function EnemyView:SetHighLight(isLight, eScale, dur, func)
end), ec, dur):SetEase(Ease.Linear) end), ec, dur):SetEase(Ease.Linear)
end end
-- 播放动画 -- 播放动画
function EnemyView:PlaySpineAnim(gog, time, name, isLoop) function EnemyView:PlaySpineAnim(gog, time, name, isLoop)
if isLoop then if isLoop then
gog.AnimationState:SetAnimation(time, name, isLoop) gog.AnimationState:SetAnimation(time, name, isLoop)
self.currAniName=name
else else
local _complete = nil local _complete = nil
_complete = function(state) _complete = function(state)
gog.AnimationState.Complete = gog.AnimationState.Complete - _complete gog.AnimationState.Complete = gog.AnimationState.Complete - _complete
gog.AnimationState:SetAnimation(0, "idle", true) gog.AnimationState:SetAnimation(0, "idle", true)
self.currAniName="idle"
end end
gog.AnimationState:ClearTracks() -- 清除上一个动画的影响(修复概率攻击动画播放错误的问题) gog.AnimationState:ClearTracks() -- 清除上一个动画的影响(修复概率攻击动画播放错误的问题)
gog.AnimationState:SetAnimation(time, name, isLoop) gog.AnimationState:SetAnimation(time, name, isLoop)
self.currAniName=name
gog.AnimationState.Complete = gog.AnimationState.Complete + _complete gog.AnimationState.Complete = gog.AnimationState.Complete + _complete
end end
end end
@ -536,22 +541,30 @@ function EnemyView:DOHitEffect(time, func)
if not time or time < 0.3 then if not time or time < 0.3 then
time = 0.3 time = 0.3
end end
-- 受击放大1.2倍 if self.currAniName~="idle" and self.currAniName~="hit" then
self:DoScale(1.2, 0.1) -- 受击放大1.2倍
-- 卡面变红 self:DoScale(1.2, 0.1)
self.RoleLiveGOGraphic:DOColor(Color.New(1,0,0,1), 0.1):OnComplete(function () -- 卡面变红
self.RoleLiveGOGraphic:DOColor(Color.New(1,1,1,1), 0.1):SetDelay(time) self.RoleLiveGOGraphic:DOColor(Color.New(1,0,0,1), 0.1):OnComplete(function ()
end) self.RoleLiveGOGraphic:DOColor(Color.New(1,1,1,1), 0.1):SetDelay(time)
-- 震动 end)
self.RoleLiveGOTran:DOShakeAnchorPos(time, Vector2.New(200, 100), 100, 50, false, true):OnComplete(function () -- 震动
self.RoleLiveGO.transform.anchoredPosition = Vector2.New(self.outOffset[1], self.outOffset[2] ) self.RoleLiveGOTran:DOShakeAnchorPos(time, Vector2.New(200, 100), 100, 50, false, true):OnComplete(function ()
-- 恢复大小 self.RoleLiveGO.transform.anchoredPosition = Vector2.New(self.outOffset[1], self.outOffset[2] )
self:DoScale(1, 0.1) -- 恢复大小
self:DoScale(1, 0.1)
-- 回调
if func then
func()
end
end)
else
-- 回调 -- 回调
if func then if func then
func() func()
end end
end) end
end end

View File

@ -172,6 +172,7 @@ function PlayerView:onCreate(go, role, position, root)
else else
self.lvHpObj:GetComponent("RectTransform").anchoredPosition=Vector3.New(0,0,0) self.lvHpObj:GetComponent("RectTransform").anchoredPosition=Vector3.New(0,0,0)
end end
self.currAniName=""
-- 伤害文字显示 -- 伤害文字显示
self.LastBuffFloatingTime = Time.realtimeSinceStartup self.LastBuffFloatingTime = Time.realtimeSinceStartup
self.BuffFloatingCount = 0 self.BuffFloatingCount = 0
@ -384,16 +385,20 @@ function PlayerView:SetHighLight(isLight, eScale, dur, func)
end end
-- 播放动画 -- 播放动画
function PlayerView:PlaySpineAnim(gog, time, name, isLoop) function PlayerView:PlaySpineAnim(gog, time, name, isLoop)
if isLoop then if isLoop then
self.currAniName=name
gog.AnimationState:SetAnimation(time, name, isLoop) gog.AnimationState:SetAnimation(time, name, isLoop)
else else
local _complete = nil local _complete = nil
_complete = function(state) _complete = function(state)
gog.AnimationState.Complete = gog.AnimationState.Complete - _complete gog.AnimationState.Complete = gog.AnimationState.Complete - _complete
self.currAniName="idle"
gog.AnimationState:SetAnimation(0, "idle", true) gog.AnimationState:SetAnimation(0, "idle", true)
end end
gog.AnimationState:ClearTracks() -- 清除上一个动画的影响(修复概率攻击动画播放错误的问题) gog.AnimationState:ClearTracks() -- 清除上一个动画的影响(修复概率攻击动画播放错误的问题)
self.currAniName=name
gog.AnimationState:SetAnimation(time, name, isLoop) gog.AnimationState:SetAnimation(time, name, isLoop)
gog.AnimationState.Complete = gog.AnimationState.Complete + _complete gog.AnimationState.Complete = gog.AnimationState.Complete + _complete
end end
@ -443,8 +448,8 @@ function PlayerView:OnSkillEnd()
--local cardRenderMat = self.liveRender.material --local cardRenderMat = self.liveRender.material
--cardRenderMat:SetInt("_IsMask", 1) --cardRenderMat:SetInt("_IsMask", 1)
-- 动画播放就停止 -- 动画播放就停止
if self.rlgTween2 then self.rlgTween2:Kill() end --if self.rlgTween2 then self.rlgTween2:Kill() end
if self.rlgTween3 then self.rlgTween3:Kill() end --if self.rlgTween3 then self.rlgTween3:Kill() end
--self.RoleLiveParnet.transform.localScale = Vector3.one --Vector2.New(self.offset[1], self.offset[2]) --self.RoleLiveParnet.transform.localScale = Vector3.one --Vector2.New(self.offset[1], self.offset[2])
--self.RoleLiveParnet.transform.localPosition = Vector3(0, 0, 0) --self.RoleLiveParnet.transform.localPosition = Vector3(0, 0, 0)
--self.liveRender.transform.anchoredPosition = Vector2.zero--Vector2.New(self.offset[1], self.offset[2]) --self.liveRender.transform.anchoredPosition = Vector2.zero--Vector2.New(self.offset[1], self.offset[2])
@ -595,35 +600,42 @@ function PlayerView:DOHitEffect(time, func)
if not time or time < 0.3 then if not time or time < 0.3 then
time = 0.3 time = 0.3
end end
-- 受击放大1.2倍 if self.currAniName~="idle" and self.currAniName~="hit" then
self:DoScale(1.2, 0.1) -- 受击放大1.2倍
-- 卡面变红 self:DoScale(1.2, 0.1)
DoTween.To(DG.Tweening.Core.DOGetter_float( function () return 1 end), -- 卡面变红
DG.Tweening.Core.DOSetter_float(function (progress) DoTween.To(DG.Tweening.Core.DOGetter_float( function () return 1 end),
local color = Color.New(1, progress, progress, 1)
Util.SetColor(self.GameObject, color)
Util.SetColor(self.RoleLiveGOGraphic, color)
end), 0, 0.1):SetEase(Ease.Linear):OnComplete(function()
DoTween.To(DG.Tweening.Core.DOGetter_float( function () return 0 end),
DG.Tweening.Core.DOSetter_float(function (progress) DG.Tweening.Core.DOSetter_float(function (progress)
local color = Color.New(1, progress, progress, 1) local color = Color.New(1, progress, progress, 1)
Util.SetColor(self.GameObject, color) Util.SetColor(self.GameObject, color)
Util.SetColor(self.RoleLiveGOGraphic, color) Util.SetColor(self.RoleLiveGOGraphic, color)
end), 1, 0.1):SetEase(Ease.Linear):SetDelay(time) end), 0, 0.1):SetEase(Ease.Linear):OnComplete(function()
end) DoTween.To(DG.Tweening.Core.DOGetter_float( function () return 0 end),
-- 震动 DG.Tweening.Core.DOSetter_float(function (progress)
self.RoleLiveGOTran:DOShakeAnchorPos(time, Vector2.New(200, 100), 100, 50, false, true):OnComplete(function () local color = Color.New(1, progress, progress, 1)
self.RoleLiveGOTran.anchoredPosition = Vector2.New(self.outOffset[1], self.outOffset[2] ) Util.SetColor(self.GameObject, color)
-- if self.GameObject then Util.SetColor(self.RoleLiveGOGraphic, color)
-- self.GameObject.transform.parent.anchoredPosition = Vector2.New(self.role.position == 1 and -145 or 0, -221) end), 1, 0.1):SetEase(Ease.Linear):SetDelay(time)
-- end end)
-- 恢复大小 -- 震动
self:DoScale(1, 0.1) self.RoleLiveGOTran:DOShakeAnchorPos(time, Vector2.New(200, 100), 100, 50, false, true):OnComplete(function ()
-- 回调 self.RoleLiveGOTran.anchoredPosition = Vector2.New(self.outOffset[1], self.outOffset[2] )
-- if self.GameObject then
-- self.GameObject.transform.parent.anchoredPosition = Vector2.New(self.role.position == 1 and -145 or 0, -221)
-- end
-- 恢复大小
self:DoScale(1, 0.1)
-- 回调
if func then
func()
end
end)
else
if func then if func then
func() func()
end end
end) end
end end