【战斗】战斗表现添加射线类型特凶啊

dev_chengFeng
gaoxin 2020-11-17 18:31:11 +08:00
parent 05076eb743
commit be0195af18
1 changed files with 71 additions and 0 deletions

View File

@ -348,6 +348,47 @@ function SkillCaster:CheckFullSceenSkill(combat, skill)
end
-- 射线特效
elseif combat.EffectType == 7 then
local targets = skill:GetDirectTargets()
for _, target in ipairs(targets) do
local tv = self.owner.RootPanel.GetRoleView(target)
if tv then
local offset = combat.Offset and Vector3.New(combat.Offset[1], combat.Offset[2], 0) or Vector3.zero
local sortingOrder = BattleManager.GetBattleSorting() + 40
local go2 = BattleManager.LoadAsset(combat.Bullet, sortingOrder)
go2.transform:SetParent(self.owner.GameObject.transform.parent)
-- 检测特效旋转
if self:CheckRotate(go2, combat.Orientation) then
offset = -offset
end
go2.transform.localPosition = Vector3.zero
go2.transform.anchoredPosition = offset
-- 特效旋转补正
local fixRotate = self:CalRoleRotate(self.owner, tv)
go2.transform.localEulerAngles = go2.transform.localEulerAngles + fixRotate
-- 缩放
go2.transform:SetParent(self.effectRoot.transform)
go2:SetActive(true)
local dis = self:CheckRoleDistance(self.effectRoot, self.owner, tv)
local sl = dis/1000
go2.transform.localScale = Vector3.New(1, sl, 1)
--
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.KeyFrame/1000)
end
end
end
@ -358,6 +399,36 @@ function SkillCaster:CheckFullSceenSkill(combat, skill)
end)
end
function SkillCaster:CalRoleRotate(baseRole, targetRole)
local basePos = baseRole.GameObject.transform.position
local targetPos = targetRole.GameObject.transform.position
local deltaX = targetPos.x - basePos.x
local deltaY = targetPos.y - basePos.y
local deltaR = math.atan(math.abs(deltaX/deltaY))/math.pi*180
if baseRole.camp == 0 and deltaX > 0 then
return Vector3.New(0, 0, -deltaR)
elseif baseRole.camp == 0 and deltaX < 0 then
return Vector3.New(0, 0, deltaR)
elseif baseRole.camp == 1 and deltaX < 0 then
return Vector3.New(0, 0, -deltaR)
elseif baseRole.camp == 1 and deltaX > 0 then
return Vector3.New(0, 0, deltaR)
end
return Vector3.zero
end
function SkillCaster:CheckRoleDistance(baseRoot, role1, role2)
local pos1 = baseRoot.transform:InverseTransformPoint(role1.GameObject.transform.position)
local pos2 = baseRoot.transform:InverseTransformPoint(role2.GameObject.transform.position)
local dis = math.distanceXY(pos1, pos2)
return dis
end
-- 检测前摇技能释放
function SkillCaster:CheckSkillForoleEffect(combat, skill)
if not skill then