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

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.rageText.gameObject:SetActive(false)
self.rageText.text = ""
self.currAniName="idle"
-- 伤害文字显示
self.LastBuffFloatingTime = Time.realtimeSinceStartup
self.BuffFloatingCount = 0
@ -362,18 +362,23 @@ function EnemyView:SetHighLight(isLight, eScale, dur, func)
end), ec, dur):SetEase(Ease.Linear)
end
-- 播放动画
function EnemyView:PlaySpineAnim(gog, time, name, isLoop)
if isLoop then
gog.AnimationState:SetAnimation(time, name, isLoop)
self.currAniName=name
else
local _complete = nil
_complete = function(state)
gog.AnimationState.Complete = gog.AnimationState.Complete - _complete
gog.AnimationState:SetAnimation(0, "idle", true)
self.currAniName="idle"
end
gog.AnimationState:ClearTracks() -- 清除上一个动画的影响(修复概率攻击动画播放错误的问题)
gog.AnimationState:SetAnimation(time, name, isLoop)
self.currAniName=name
gog.AnimationState.Complete = gog.AnimationState.Complete + _complete
end
end
@ -536,22 +541,30 @@ function EnemyView:DOHitEffect(time, func)
if not time or time < 0.3 then
time = 0.3
end
-- 受击放大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)
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:DoScale(1, 0.1)
if self.currAniName~="idle" and self.currAniName~="hit" then
-- 受击放大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)
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:DoScale(1, 0.1)
-- 回调
if func then
func()
end
end)
else
-- 回调
if func then
func()
end
end)
end
end

View File

@ -172,6 +172,7 @@ function PlayerView:onCreate(go, role, position, root)
else
self.lvHpObj:GetComponent("RectTransform").anchoredPosition=Vector3.New(0,0,0)
end
self.currAniName=""
-- 伤害文字显示
self.LastBuffFloatingTime = Time.realtimeSinceStartup
self.BuffFloatingCount = 0
@ -384,16 +385,20 @@ function PlayerView:SetHighLight(isLight, eScale, dur, func)
end
-- 播放动画
function PlayerView:PlaySpineAnim(gog, time, name, isLoop)
if isLoop then
self.currAniName=name
gog.AnimationState:SetAnimation(time, name, isLoop)
else
local _complete = nil
_complete = function(state)
gog.AnimationState.Complete = gog.AnimationState.Complete - _complete
self.currAniName="idle"
gog.AnimationState:SetAnimation(0, "idle", true)
end
gog.AnimationState:ClearTracks() -- 清除上一个动画的影响(修复概率攻击动画播放错误的问题)
self.currAniName=name
gog.AnimationState:SetAnimation(time, name, isLoop)
gog.AnimationState.Complete = gog.AnimationState.Complete + _complete
end
@ -443,8 +448,8 @@ function PlayerView:OnSkillEnd()
--local cardRenderMat = self.liveRender.material
--cardRenderMat:SetInt("_IsMask", 1)
-- 动画播放就停止
if self.rlgTween2 then self.rlgTween2:Kill() end
if self.rlgTween3 then self.rlgTween3:Kill() end
--if self.rlgTween2 then self.rlgTween2: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.localPosition = Vector3(0, 0, 0)
--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
time = 0.3
end
-- 受击放大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)
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),
if self.currAniName~="idle" and self.currAniName~="hit" then
-- 受击放大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)
local color = Color.New(1, progress, progress, 1)
Util.SetColor(self.GameObject, color)
Util.SetColor(self.RoleLiveGOGraphic, color)
end), 1, 0.1):SetEase(Ease.Linear):SetDelay(time)
end)
-- 震动
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)
-- 回调
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)
local color = Color.New(1, progress, progress, 1)
Util.SetColor(self.GameObject, color)
Util.SetColor(self.RoleLiveGOGraphic, color)
end), 1, 0.1):SetEase(Ease.Linear):SetDelay(time)
end)
-- 震动
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
func()
end
end)
end
end