特效旋转功能添加

dev_chengFeng
gaoxin 2020-07-23 13:44:03 +08:00
parent 87b221b621
commit 3cf3cf7e90
3 changed files with 41 additions and 12 deletions

View File

@ -548,6 +548,7 @@ function this.GetSkillCombat(id)
SkillDuration = combat.SkillDuration,
BeforeOrientation = combat.BeforeOrientation,
Orientation = combat.Orientation,
HitOrientation = combat.HitOrientation,
BeforeEffectType = combat.BeforeEffectType ,
EffectType = combat.EffectType ,
HitEffectType = combat.HitEffectType,

View File

@ -980,6 +980,21 @@ function RoleView:GetEffectPosition(skill)
return targetCamp == 0 and FullEffectPosition["My_COL_"..col] or FullEffectPosition["Enemy_COL_"..col]
end
end
-- 检测特效旋转
function RoleView:CheckRotate(go, orientation)
-- 判断是否旋转
local isR = orientation[1] and orientation[1][1] or 0
local rt = orientation[2]
rt = rt and Vector3.New(rt[1], rt[2], rt[3]) or Vector3.zero
if (self.camp == 0 and isR == 1)
or (self.camp == 1 and isR == 2) then
go.transform.localRotation = rt
return true
end
go.transform.localRotation = Vector3.zero
end
-- 检测是否需要释放全屏技能
function RoleView:CheckFullSceenSkill(combat, skill)
if not skill then
@ -1006,6 +1021,10 @@ function RoleView:CheckFullSceenSkill(combat, skill)
--
local go = loadAsset(path, self.RootPanel.skillEffectRoot:GetComponent("Canvas").sortingOrder)
-- 检测特效旋转
if self:CheckRotate(go, combat.Orientation) then
offset = -offset
end
go.transform:SetParent(self.RootPanel.skillEffectRoot.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = pos + offset
@ -1027,14 +1046,12 @@ function RoleView:CheckFullSceenSkill(combat, skill)
local offset = combat.Offset and Vector3.New(combat.Offset[1], combat.Offset[2], 0) or Vector3.zero
local go = loadAsset(path, self.RootPanel.skillEffectRoot:GetComponent("Canvas").sortingOrder)
go.transform:SetParent(self.RootPanel.skillEffectRoot.transform)
go.transform.localScale = Vector3.one
if self.camp == 0 and combat.Orientation == 1 then
go.transform.localRotation = Vector3.New(0, 0, 180)
-- 检测特效旋转
if self:CheckRotate(go, combat.Orientation) then
offset = -offset
else
go.transform.localRotation = Vector3.zero
end
go.transform.localPosition = spos + offset
go.transform.localScale = Vector3.one
go:SetActive(true)
self:AddDelayRecycleRes(path, go, duration)
@ -1056,6 +1073,10 @@ function RoleView:CheckFullSceenSkill(combat, skill)
local sortingOrder = tv.role.camp == 0 and tv.GameObject:GetComponent("Canvas").sortingOrder + 21 or nil
local go2 = loadAsset(combat.Bullet, sortingOrder)
go2.transform:SetParent(tv.GameObject.transform.parent)
-- 检测特效旋转
if self:CheckRotate(go2, combat.Orientation) then
offset = -offset
end
go2.transform.localScale = Vector3.one
go2.transform.localPosition = Vector3.zero
go2.transform.anchoredPosition = offset
@ -1072,6 +1093,10 @@ function RoleView:CheckFullSceenSkill(combat, skill)
local sortingOrder = self.RootPanel.skillEffectRoot:GetComponent("Canvas").sortingOrder
local go2 = loadAsset(combat.Bullet, sortingOrder)
go2.transform:SetParent(self.RootPanel.skillEffectRoot.transform)
-- 检测特效旋转
if self:CheckRotate(go2, combat.Orientation) then
offset = -offset
end
go2.transform.localScale = Vector3.one
go2.transform.localPosition = Vector3.zero
go2.transform.anchoredPosition = offset
@ -1114,16 +1139,11 @@ function RoleView:CheckSkillForoleEffect(combat, skill)
go.transform:SetParent(self.RootPanel.skillEffectRoot.transform)
end
if self.camp == 0 and combat.BeforeOrientation == 1 then
go.transform.localRotation = Vector3.New(0, 0, 180)
-- 检测特效旋转
if self:CheckRotate(go, combat.BeforeOrientation) then
offset = -offset
else
go.transform.localRotation = Vector3.zero
end
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
go.transform.anchoredPosition = offset
@ -1154,6 +1174,10 @@ function RoleView:CheckSkillHitEffect(checkType, combat, skill)
local sortingOrder = tv.role.camp == 0 and tv.GameObject:GetComponent("Canvas").sortingOrder + 21 or nil
local go = loadAsset(combat.Hit, sortingOrder)
go.transform:SetParent(self.RootPanel.skillEffectRoot.transform)
-- 检测特效旋转
if self:CheckRotate(go, combat.HitOrientation) then
offset = -offset
end
go.transform.localScale = Vector3.one
go.transform.localPosition = tpos + offset
go:SetActive(true)
@ -1168,6 +1192,10 @@ function RoleView:CheckSkillHitEffect(checkType, combat, skill)
local sortingOrder = self.role.camp == 0 and self.GameObject:GetComponent("Canvas").sortingOrder + 21 or nil
local go2 = loadAsset(combat.Hit, sortingOrder)
go2.transform:SetParent(self.GameObject.transform.parent)
-- 检测特效旋转
if self:CheckRotate(go2, combat.HitOrientation) then
offset = -offset
end
go2.transform.localScale = Vector3.one
go2.transform.localPosition = Vector3.zero--self.GameObject.transform.localPosition + Vector3.New(0, self.BuffFloatingCount * 180, 0)
go2.transform.anchoredPosition = offset--Vector2.zero