2021-06-09 16:05:19 +08:00
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
local Bezier = require("Base.Bezier")
|
|
|
|
|
local SkillLogicConfig = ConfigManager.GetConfig(ConfigName.SkillLogicConfig)
|
|
|
|
|
local BuffEffectConfig = ConfigManager.GetConfig(ConfigName.BuffEffectConfig)
|
|
|
|
|
|
|
|
|
|
SkillCaster = {}
|
|
|
|
|
|
|
|
|
|
function SkillCaster.New(unit, actionTime, soundTime, soundName, castingEfectNode, castingNameNode)
|
|
|
|
|
local o = {}
|
|
|
|
|
setmetatable(o, {__index = SkillCaster})
|
|
|
|
|
o:ctor(unit, actionTime, soundTime, soundName, castingEfectNode, castingNameNode)
|
|
|
|
|
return o
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function SkillCaster:ctor(unit, actionTime, soundTime, soundName, castingEfectNode, castingNameNode)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
self.spLoader = unit.spLoader
|
2020-11-01 15:46:48 +08:00
|
|
|
|
self.owner = unit
|
|
|
|
|
self.actionTime = actionTime -- 立绘攻击动作时间
|
|
|
|
|
self.soundTime = soundTime -- 声音播放时机
|
|
|
|
|
self.soundName = soundName -- 声音资源名称
|
|
|
|
|
self.castingEfectNode = castingEfectNode -- cast特效资源
|
|
|
|
|
self.castingNameNode = castingNameNode -- cast名称资源
|
|
|
|
|
self.effectRoot = self.owner.RootPanel.skillEffectRoot
|
2021-12-24 16:11:53 +08:00
|
|
|
|
self.roleConfig=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,unit.roleId)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
--
|
|
|
|
|
self.owner.role.Event:AddEvent(BattleEventName.SkillCast, self.OnSkillCast, self)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function SkillCaster:OnSkillCast(skill)
|
|
|
|
|
if not skill then return end
|
2020-11-06 13:01:38 +08:00
|
|
|
|
|
2020-11-06 20:45:21 +08:00
|
|
|
|
local eid = BattleManager.GetCombatIdBySkin(skill.id, self.owner.skinId)
|
2020-11-06 10:12:24 +08:00
|
|
|
|
local combat = BattleManager.GetSkillCombat(eid)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
if not combat then return end
|
|
|
|
|
-- 追击显示追击文字
|
|
|
|
|
if skill.isAdd then
|
2021-01-26 17:08:39 +08:00
|
|
|
|
self.owner.Floater:ImageBuffFloating("z_zhandou_zhuiji_zh")
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
2023-08-30 21:33:02 +08:00
|
|
|
|
if self.owner.RoleLiveGO==nil then
|
|
|
|
|
LogError("当前角色没有spine动画")
|
|
|
|
|
return
|
|
|
|
|
end
|
2023-06-20 18:01:51 +08:00
|
|
|
|
local startPos=self.owner.RoleLiveGO.transform.position
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 高亮
|
|
|
|
|
BattleManager.PauseBattle()
|
|
|
|
|
-- 调用上层接口
|
|
|
|
|
if self.owner.OnSkillCastStart then
|
2021-11-25 15:04:55 +08:00
|
|
|
|
self.owner:OnSkillCastStart(skill)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
2023-09-18 15:41:32 +08:00
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
self.owner.RootPanel.SetRoleHighLight(self.owner, skill:GetDirectTargets(), function()
|
2023-09-18 15:41:32 +08:00
|
|
|
|
-- local duration = combat.KeyFrame/1000
|
2020-11-01 15:46:48 +08:00
|
|
|
|
|
|
|
|
|
local function _PlaySkill()
|
2021-08-25 20:59:26 +08:00
|
|
|
|
if IsNull(self.owner.GameObject) then
|
|
|
|
|
return
|
|
|
|
|
end
|
2021-12-20 10:02:38 +08:00
|
|
|
|
local type=0
|
2023-06-28 15:58:29 +08:00
|
|
|
|
if self.roleConfig and self.roleConfig.ReadyAction and (self.roleConfig.ReadyAction>0) and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill)then
|
2023-07-17 18:47:07 +08:00
|
|
|
|
-- type=1
|
|
|
|
|
-- self.actionTime=self.roleConfig.ReadyAction/1000
|
2021-12-20 10:02:38 +08:00
|
|
|
|
end
|
2023-07-13 14:38:34 +08:00
|
|
|
|
type=skill.type==BattleSkillType.Special and BattleSkillType.Special or 0
|
|
|
|
|
-- if self.owner.role.readyAction~=0 then
|
|
|
|
|
|
|
|
|
|
-- self.actionTime=self.owner.role.readyAction/1000
|
|
|
|
|
-- end
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 调用上层接口
|
2023-06-20 18:01:51 +08:00
|
|
|
|
-- if self.owner.OnSkillPlay then
|
|
|
|
|
-- self.owner:OnSkillPlay(type)
|
|
|
|
|
-- end
|
2023-07-02 21:52:32 +08:00
|
|
|
|
self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder+50
|
2023-06-29 15:04:58 +08:00
|
|
|
|
if combat.AttackDisplacement ==1 then
|
2023-10-23 15:09:31 +08:00
|
|
|
|
local displaceoffset={[1]=0.4,[2]=-0.2}
|
2023-07-13 14:38:34 +08:00
|
|
|
|
-- if skill.type==2 and self.owner.superSkillAttackDisplaceoffset then
|
|
|
|
|
-- displaceoffset=self.owner.superSkillAttackDisplaceoffset
|
|
|
|
|
-- elseif self.owner.SkillAttackDisplaceoffset then
|
|
|
|
|
-- displaceoffset=self.owner.SkillAttackDisplaceoffset
|
|
|
|
|
-- end
|
|
|
|
|
if skill.AttackDisplaceOffset then
|
|
|
|
|
displaceoffset=skill.AttackDisplaceOffset
|
|
|
|
|
end
|
2023-06-29 15:04:58 +08:00
|
|
|
|
self.owner.GameObject:SetActive(false)
|
2023-07-02 21:52:32 +08:00
|
|
|
|
local targets = skill:GetDirectTargets()
|
2023-06-20 18:01:51 +08:00
|
|
|
|
for _, target in ipairs(targets) do
|
|
|
|
|
local t= self.owner.RootPanel.GetRoleView(target)
|
2023-10-23 15:09:31 +08:00
|
|
|
|
self.owner.RoleLiveGO.transform:DOMove(Vector3.New(t.GameObject.transform.position.x-(self.owner.camp==0 and displaceoffset[1] or(-displaceoffset[1])),t.GameObject.transform.position.y+displaceoffset[2],t.GameObject.transform.position.z), combat.AttackDisplaceTime/1000, false):OnComplete(function ()
|
2023-06-20 18:01:51 +08:00
|
|
|
|
if self.owner.OnSkillPlay then
|
2023-08-04 18:58:14 +08:00
|
|
|
|
self.owner:OnSkillPlay(type,combat)
|
2023-06-20 18:01:51 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
2023-07-02 21:52:32 +08:00
|
|
|
|
else
|
2023-06-20 18:01:51 +08:00
|
|
|
|
if self.owner.OnSkillPlay then
|
2023-08-04 18:58:14 +08:00
|
|
|
|
self.owner:OnSkillPlay(type,combat)
|
2023-06-20 18:01:51 +08:00
|
|
|
|
end
|
2023-06-29 15:04:58 +08:00
|
|
|
|
end
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 播放
|
2020-11-02 11:54:48 +08:00
|
|
|
|
-- 这里相当于技能前摇,等待立绘播放到需要释放关键帧的时间时继续释放技能(人物前摇特效)
|
2023-07-13 14:38:34 +08:00
|
|
|
|
if combat.AttackDisplacement ==1 then
|
|
|
|
|
local displaceoffset={[1]={[1]=0.4,[2]=-0.2}}
|
|
|
|
|
-- if skill.type==2 and self.owner.superSkillAttackDisplaceoffset then
|
|
|
|
|
-- displaceoffset=self.owner.superSkillAttackDisplaceoffset
|
|
|
|
|
-- elseif self.owner.SkillAttackDisplaceoffset then
|
|
|
|
|
-- displaceoffset=self.owner.SkillAttackDisplaceoffset
|
|
|
|
|
-- end
|
|
|
|
|
if skill.AttackDisplaceOffset then
|
|
|
|
|
displaceoffset=skill.AttackDisplaceOffset
|
|
|
|
|
end
|
|
|
|
|
self.owner.GameObject:SetActive(false)
|
|
|
|
|
local targets = skill:GetDirectTargets()
|
|
|
|
|
for _, target in ipairs(targets) do
|
|
|
|
|
local t= self.owner.RootPanel.GetRoleView(target)
|
2023-10-23 15:09:31 +08:00
|
|
|
|
self.owner.RoleLiveGO.transform:DOMove(Vector3.New(t.GameObject.transform.position.x-(self.owner.camp==0 and displaceoffset[1] or(-displaceoffset[1])),t.GameObject.transform.position.y+displaceoffset[2],t.GameObject.transform.position.z), combat.AttackDisplaceTime/1000, false):OnComplete(function ()
|
2023-07-13 14:38:34 +08:00
|
|
|
|
if self.owner.OnSkillPlay then
|
2023-08-04 18:58:14 +08:00
|
|
|
|
self.owner:OnSkillPlay(type,combat)
|
2023-07-13 14:38:34 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if self.owner.OnSkillPlay then
|
2023-08-04 18:58:14 +08:00
|
|
|
|
self.owner:OnSkillPlay(type,combat)
|
2023-07-13 14:38:34 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-11-02 11:54:48 +08:00
|
|
|
|
if self.owner.role.type == BattleUnitType.Role then
|
2021-11-26 13:58:24 +08:00
|
|
|
|
if combat.BeforeEffectDelay then
|
|
|
|
|
self.owner:DelayFunc(combat.BeforeEffectDelay/1000, function()
|
|
|
|
|
self:CheckSkillForoleEffect(combat, skill)
|
2023-07-13 14:38:34 +08:00
|
|
|
|
|
2021-11-26 13:58:24 +08:00
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
self:CheckSkillForoleEffect(combat, skill)
|
2023-07-13 14:38:34 +08:00
|
|
|
|
|
2021-11-26 13:58:24 +08:00
|
|
|
|
end
|
2020-11-02 11:54:48 +08:00
|
|
|
|
end
|
2023-09-18 15:41:32 +08:00
|
|
|
|
LogError("startreturn"..os.date())
|
2023-07-17 18:47:07 +08:00
|
|
|
|
--self.actionTime换成combatactiontime
|
2023-09-18 15:41:32 +08:00
|
|
|
|
local skillduration=600
|
|
|
|
|
self.owner:DelayFunc(combat.KeyFrame/1000, function()
|
|
|
|
|
self:CheckFullSceenSkill(combat, skill,skillduration)
|
|
|
|
|
end)
|
|
|
|
|
self.owner:DelayFunc(combat.ActionTime/1000+0+(combat.EffectType==8 and 0 or combat.BulletTime/1000), function()
|
|
|
|
|
-- self.owner:DelayFunc((combat.SkillNumbetTime[1][1]==0 and combat.ActionTime or combat.SkillNumbetTime[#combat.SkillNumbetTime][2])/1000, function()
|
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 继续战斗放在特效加载之后,避免特效加载时间对战斗时间得影响
|
|
|
|
|
BattleManager.ResumeBattle()
|
2023-09-18 15:41:32 +08:00
|
|
|
|
if combat.ShockScreen == 1 then
|
|
|
|
|
self:checkShake(combat)
|
|
|
|
|
end
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 取消高亮
|
2023-09-18 15:41:32 +08:00
|
|
|
|
self.owner:DelayFunc((combat.SkillDuration)/1000, function()
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 恢复高亮
|
2023-09-18 15:41:32 +08:00
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
self.owner.RootPanel.SetRoleHighLight()
|
|
|
|
|
-- 调用上层接口
|
2023-09-18 15:41:32 +08:00
|
|
|
|
|
2023-06-29 15:04:58 +08:00
|
|
|
|
if combat.AttackDisplacement ==1 then
|
2023-09-18 15:41:32 +08:00
|
|
|
|
self.owner:DelayFunc(combat.AttackDisplaceBackTime/1000+(combat.SkillNumbetTime[1][1]==0 and 0 or combat.SkillNumbetTime[#combat.SkillNumbetTime][2])/1000+1.3, function()
|
2023-07-06 14:08:10 +08:00
|
|
|
|
self.owner.RoleLiveGO.transform:DOMove(startPos, combat.AttackDisplaceTime/1000, false):OnComplete(function ()
|
|
|
|
|
self.owner.GameObject:SetActive(true)
|
|
|
|
|
self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder-50
|
2023-09-18 15:41:32 +08:00
|
|
|
|
if self.owner.OnSkillEnd then
|
|
|
|
|
self.owner:OnSkillEnd()
|
|
|
|
|
end
|
2023-07-06 14:08:10 +08:00
|
|
|
|
end)
|
2023-09-18 15:41:32 +08:00
|
|
|
|
LogError("return"..os.date())
|
2023-06-20 18:01:51 +08:00
|
|
|
|
end)
|
2023-07-06 14:08:10 +08:00
|
|
|
|
else
|
|
|
|
|
self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder-50
|
2023-09-18 15:41:32 +08:00
|
|
|
|
if self.owner.OnSkillEnd then
|
|
|
|
|
self.owner:OnSkillEnd()
|
|
|
|
|
end
|
2023-06-29 15:04:58 +08:00
|
|
|
|
end
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- 攻击音效
|
|
|
|
|
if self.soundName then
|
|
|
|
|
self.owner:DelayFunc(self.soundTime - 0.3, function()
|
|
|
|
|
SoundManager.PlaySound(self.soundName)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--
|
|
|
|
|
if combat.VerticalDrawing == 1 then
|
|
|
|
|
_PlaySkill()
|
|
|
|
|
elseif combat.VerticalDrawing == 2 then
|
2020-11-02 11:54:48 +08:00
|
|
|
|
self:PlaySkillCastingEffect(combat, skill, function()
|
2020-11-01 15:46:48 +08:00
|
|
|
|
_PlaySkill()
|
2023-06-20 18:01:51 +08:00
|
|
|
|
|
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-02 11:54:48 +08:00
|
|
|
|
function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 播放casting
|
|
|
|
|
self.castingEfectNode:SetActive(false)
|
|
|
|
|
self.castingEfectNode:SetActive(true)
|
|
|
|
|
-- 播放casting声音
|
|
|
|
|
SoundManager.PlaySound(SoundConfig.Sound_RoleCasting)
|
|
|
|
|
if combat.skillname and combat.skillname ~= "" then
|
|
|
|
|
self.castingNameNode:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
self.castingNameNode:GetComponent("Image").sprite = self.spLoader:LoadSprite(combat.skillname)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
self.castingNameNode:GetComponent("Image"):SetNativeSize()
|
|
|
|
|
else
|
|
|
|
|
self.castingNameNode:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
-- 技能名音效
|
2021-04-08 17:32:40 +08:00
|
|
|
|
if IS_PLAY_VOICE and combat.SkillNameVoice and GetCurLanguage() == 0 then
|
2020-11-01 15:46:48 +08:00
|
|
|
|
SoundManager.PlaySound(combat.SkillNameVoice)
|
|
|
|
|
end
|
|
|
|
|
|
2020-11-02 11:54:48 +08:00
|
|
|
|
-- 这里相当于技能前摇,等待立绘播放到需要释放关键帧的时间时继续释放技能(灵兽前摇特效)
|
2023-04-06 14:02:32 +08:00
|
|
|
|
if self.owner.role.type == BattleUnitType.Monster or self.owner.role.type == BattleUnitType.Weapon then
|
2021-11-26 13:58:24 +08:00
|
|
|
|
if combat.BeforeEffectDelay then
|
|
|
|
|
self.owner:DelayFunc(combat.BeforeEffectDelay/1000, function()
|
|
|
|
|
self:CheckSkillForoleEffect(combat, skill)
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
self:CheckSkillForoleEffect(combat, skill)
|
|
|
|
|
end
|
2020-11-02 11:54:48 +08:00
|
|
|
|
end
|
2021-11-25 15:04:55 +08:00
|
|
|
|
|
|
|
|
|
if self.owner.OnSkillCastStart then
|
|
|
|
|
self.owner:OnSkillCastStart(skill)
|
|
|
|
|
end
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 调用上层接口
|
2021-12-20 10:02:38 +08:00
|
|
|
|
local type=0
|
2023-06-28 15:58:29 +08:00
|
|
|
|
if self.roleConfig and self.roleConfig.ReadyAction and (self.roleConfig.ReadyAction>0) and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill) then
|
2021-12-20 10:02:38 +08:00
|
|
|
|
type=1
|
|
|
|
|
end
|
2023-07-13 14:38:34 +08:00
|
|
|
|
if self.roleConfig and self.owner.role.readyAction~=0 and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill) then
|
|
|
|
|
type=1
|
|
|
|
|
end
|
2021-12-14 13:51:41 +08:00
|
|
|
|
local _ExtraTime
|
2020-11-01 15:46:48 +08:00
|
|
|
|
if self.owner.OnSkillCastingStart then
|
2021-12-20 10:02:38 +08:00
|
|
|
|
_ExtraTime = self.owner:OnSkillCastingStart(type)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
2021-12-14 13:51:41 +08:00
|
|
|
|
_ExtraTime = _ExtraTime or 0
|
2020-11-01 15:46:48 +08:00
|
|
|
|
|
2021-01-09 10:58:15 +08:00
|
|
|
|
self.owner:DelayFunc(2, function()
|
2021-12-14 13:51:41 +08:00
|
|
|
|
-- 判断是否要额外增加casting显示时间
|
|
|
|
|
self.owner:DelayFunc(_ExtraTime, function ()
|
|
|
|
|
self.castingEfectNode:SetActive(false)
|
|
|
|
|
-- 调用上层接口
|
|
|
|
|
if self.owner.OnSkillCastingEnd then
|
|
|
|
|
self.owner:OnSkillCastingEnd()
|
|
|
|
|
end
|
|
|
|
|
end)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
|
|
|
|
|
if func then func() func = nil end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-20 18:01:51 +08:00
|
|
|
|
--横版需要改动
|
2020-11-01 15:46:48 +08:00
|
|
|
|
local FullEffectPosition = {
|
2023-09-19 18:56:46 +08:00
|
|
|
|
-- My_All = Vector3.New(0, -566, 0),
|
|
|
|
|
-- My_Front = Vector3.New(-120, -410, 0),
|
|
|
|
|
-- My_Behind = Vector3.New(20, -760, 0),
|
2023-06-28 15:58:29 +08:00
|
|
|
|
-- My_COL_1 = Vector3.New(-300, -566, 0),
|
|
|
|
|
-- My_COL_2 = Vector3.New(0, -566, 0),
|
|
|
|
|
-- My_COL_3 = Vector3.New(300, -566, 0),
|
|
|
|
|
|
|
|
|
|
|
2023-09-19 18:56:46 +08:00
|
|
|
|
-- Enemy_All = Vector3.New(0, 430, 0),
|
|
|
|
|
-- Enemy_Front = Vector3.New(-100, 340, 0),
|
|
|
|
|
-- Enemy_Behind = Vector3.New(50, 540, 0),
|
|
|
|
|
-- Enemy_COL_1 = Vector3.New(-300, 430, 0),
|
|
|
|
|
-- Enemy_COL_2 = Vector3.New(0, 430, 0),
|
|
|
|
|
-- Enemy_COL_3 = Vector3.New(300, 430, 0),
|
|
|
|
|
|
|
|
|
|
My_All = Vector3.New(-300, 0, 0),
|
|
|
|
|
My_Front = Vector3.New(-120, 0, 0),
|
|
|
|
|
My_Behind = Vector3.New(20, 0, 0),
|
|
|
|
|
My_COL_1 = Vector3.New(-300, -566, 0),
|
|
|
|
|
My_COL_2 = Vector3.New(0, -566, 0),
|
|
|
|
|
My_COL_3 = Vector3.New(300, -566, 0),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Enemy_All = Vector3.New(50, 0, 0),
|
|
|
|
|
Enemy_Front = Vector3.New(0, 0, 0),
|
|
|
|
|
Enemy_Behind = Vector3.New(150,0 , 0),
|
|
|
|
|
Enemy_COL_1 = Vector3.New(-50, 0, 0),
|
|
|
|
|
Enemy_COL_2 = Vector3.New(0, 0, 0),
|
|
|
|
|
Enemy_COL_3 = Vector3.New(50, 0, 0),
|
2020-11-01 15:46:48 +08:00
|
|
|
|
}
|
|
|
|
|
function SkillCaster:GetEffectSPostion(skill)
|
|
|
|
|
local chooseId = skill:GetDirectChooseId()
|
|
|
|
|
local chooseLimit = math.floor(chooseId / 10000) % 10
|
|
|
|
|
|
|
|
|
|
local targets = skill:GetDirectTargets()
|
|
|
|
|
local targetPos = targets[1].position
|
|
|
|
|
|
2023-09-18 15:41:32 +08:00
|
|
|
|
if chooseLimit == 3 then
|
|
|
|
|
local col = (targetPos-1) % 3 + 1
|
|
|
|
|
return self.owner.camp == 0 and FullEffectPosition["My_COL_"..col] or FullEffectPosition["Enemy_COL_"..col]
|
|
|
|
|
else
|
|
|
|
|
return self.owner.camp == 0 and FullEffectPosition.My_All or FullEffectPosition.Enemy_All
|
|
|
|
|
end
|
2023-06-28 15:58:29 +08:00
|
|
|
|
return FullEffectPosition.My_All
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
|
|
|
|
function SkillCaster:GetEffectPosition(skill)
|
|
|
|
|
local chooseId = skill:GetDirectChooseId()
|
|
|
|
|
local chooseLimit = math.floor(chooseId / 10000) % 10
|
|
|
|
|
local targets = skill:GetDirectTargets()
|
|
|
|
|
|
|
|
|
|
local targetCamp = targets[1].camp
|
|
|
|
|
local targetPos = targets[1].position
|
|
|
|
|
|
|
|
|
|
|
2023-09-18 15:41:32 +08:00
|
|
|
|
if chooseLimit == 0 or chooseLimit == 4 or chooseLimit == 5 then
|
|
|
|
|
return targetCamp == 0 and FullEffectPosition.My_All or FullEffectPosition.Enemy_All
|
2023-09-19 18:56:46 +08:00
|
|
|
|
elseif chooseLimit == 1 or chooseLimit == 2 then --前排,后排
|
2023-09-18 15:41:32 +08:00
|
|
|
|
if targetCamp == 0 then
|
|
|
|
|
return targetPos <= 3 and FullEffectPosition.My_Front or FullEffectPosition.My_Behind
|
|
|
|
|
else
|
|
|
|
|
return targetPos <= 3 and FullEffectPosition.Enemy_Front or FullEffectPosition.Enemy_Behind
|
|
|
|
|
end
|
2023-09-19 18:56:46 +08:00
|
|
|
|
elseif chooseLimit == 3 then --队列
|
2023-09-18 15:41:32 +08:00
|
|
|
|
local col = (targetPos-1) % 3 + 1
|
|
|
|
|
return targetCamp == 0 and FullEffectPosition["My_COL_"..col] or FullEffectPosition["Enemy_COL_"..col]
|
|
|
|
|
end
|
2023-06-28 15:58:29 +08:00
|
|
|
|
return FullEffectPosition.My_All
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 检测特效旋转
|
|
|
|
|
function SkillCaster:CheckRotate(go, orientation)
|
2023-06-20 18:01:51 +08:00
|
|
|
|
-- if skill ==nil then
|
|
|
|
|
|
|
|
|
|
-- goto Label
|
|
|
|
|
-- else
|
|
|
|
|
-- if skill.id==1301 then
|
|
|
|
|
-- LogError(orientation[2][1])
|
|
|
|
|
-- LogError(orientation[2][2])
|
|
|
|
|
-- LogError(orientation[2][3])
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- :: Label ::
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 判断是否旋转
|
|
|
|
|
if orientation==nil then
|
|
|
|
|
-- body
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
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
|
2020-11-02 11:54:48 +08:00
|
|
|
|
if (self.owner.camp == 0 and isR == 1)
|
|
|
|
|
or (self.owner.camp == 1 and isR == 2) then
|
2023-06-20 18:01:51 +08:00
|
|
|
|
go.transform.localRotation = Quaternion.Euler(rt.x,rt.y,rt.z)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
go.transform.localRotation = Vector3.zero
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 检测是否需要释放全屏技能
|
2023-09-18 15:41:32 +08:00
|
|
|
|
function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
if not skill then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- 指定目标弹道特效
|
|
|
|
|
if combat.EffectType == 1 then
|
|
|
|
|
local targets = skill:GetDirectTargets()
|
|
|
|
|
for _, target in ipairs(targets) do
|
|
|
|
|
self:RoleViewBullet(combat, target)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 全屏特效
|
|
|
|
|
elseif combat.EffectType == 2 then
|
|
|
|
|
local path = combat.Bullet
|
|
|
|
|
if path then
|
|
|
|
|
|
|
|
|
|
local pos = self:GetEffectPosition(skill)
|
|
|
|
|
if not pos then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- 特效的偏移量
|
|
|
|
|
local offset = combat.Offset and Vector3.New(combat.Offset[1], combat.Offset[2], 0) or Vector3.zero
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
local go = BattleManager.LoadAsset(path, self.effectRoot:GetComponent("Canvas").sortingOrder)
|
|
|
|
|
-- 检测特效旋转
|
|
|
|
|
if self:CheckRotate(go, combat.Orientation) then
|
|
|
|
|
offset = -offset
|
|
|
|
|
end
|
2023-06-28 15:58:29 +08:00
|
|
|
|
if go ~=nil then
|
|
|
|
|
go.transform:SetParent(self.effectRoot.transform)
|
|
|
|
|
go.transform.localScale = Vector3.one
|
|
|
|
|
go.transform.localPosition = pos + offset
|
|
|
|
|
go:SetActive(true)
|
2023-09-18 15:41:32 +08:00
|
|
|
|
local compnet=go:GetComponent("SkeletonGraphic")
|
|
|
|
|
if compnet~=nil then
|
|
|
|
|
-- compnet.transform.localScale = Vector3.one * 3
|
|
|
|
|
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
|
|
|
|
|
self.owner:PlaySpineAnim (compnet,0,"animation",true)
|
|
|
|
|
end
|
|
|
|
|
BattleManager.AddDelayRecycleRes(path, go, combat.BulletTime==0 and 4 or combat.BulletTime/1000)
|
2023-06-28 15:58:29 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
|
|
|
|
-- 全屏弹道特效
|
|
|
|
|
elseif combat.EffectType == 3 then
|
|
|
|
|
local path = combat.Bullet
|
2023-09-18 15:41:32 +08:00
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
if path then
|
|
|
|
|
local spos = self:GetEffectSPostion(skill)
|
|
|
|
|
local tpos = self:GetEffectPosition(skill)
|
|
|
|
|
if not spos or not tpos then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- 时间
|
|
|
|
|
local duration = combat.BulletTime/1000
|
|
|
|
|
-- 特效的偏移量
|
|
|
|
|
local offset = combat.Offset and Vector3.New(combat.Offset[1], combat.Offset[2], 0) or Vector3.zero
|
2023-06-28 15:58:29 +08:00
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
local go = BattleManager.LoadAsset(path, self.effectRoot:GetComponent("Canvas").sortingOrder)
|
2023-06-28 15:58:29 +08:00
|
|
|
|
if go ~=nil then
|
|
|
|
|
go.transform:SetParent(self.effectRoot.transform)
|
2023-09-18 15:41:32 +08:00
|
|
|
|
local compnet=go:GetComponent("SkeletonGraphic")
|
|
|
|
|
if compnet~=nil then
|
|
|
|
|
-- compnet.transform.localScale = Vector3.one * 3
|
|
|
|
|
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
|
|
|
|
|
self.owner:PlaySpineAnim (compnet,0,"animation",true)
|
|
|
|
|
end
|
2023-06-28 15:58:29 +08:00
|
|
|
|
-- 检测特效旋转
|
|
|
|
|
if self:CheckRotate(go, combat.Orientation) then
|
|
|
|
|
offset = -offset
|
|
|
|
|
end
|
|
|
|
|
go.transform.localPosition = spos + offset
|
|
|
|
|
go.transform.localScale = Vector3.one
|
|
|
|
|
go:SetActive(true)
|
|
|
|
|
BattleManager.AddDelayRecycleRes(path, go, duration)
|
|
|
|
|
|
|
|
|
|
if self.fullBulletTween then self.fullBulletTween:Kill() end
|
|
|
|
|
self.fullBulletTween = go.transform:DOLocalMove(tpos + offset, duration):SetEase(Ease.OutSine)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
2023-06-28 15:58:29 +08:00
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- :OnComplete(function()
|
|
|
|
|
-- go:SetActive(false)
|
|
|
|
|
-- end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 指定目标特效
|
|
|
|
|
elseif combat.EffectType == 4 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
|
2020-11-19 15:44:23 +08:00
|
|
|
|
|
2023-09-18 15:41:32 +08:00
|
|
|
|
-- local sortingOrder = self.effectRoot:GetComponent("Canvas").sortingOrder
|
|
|
|
|
local go2 = BattleManager.LoadSpineAsset(combat.Bullet,tv.GameObject.transform.parent )
|
2020-11-01 15:46:48 +08:00
|
|
|
|
go2.transform:SetParent(tv.GameObject.transform.parent)
|
|
|
|
|
-- 检测特效旋转
|
|
|
|
|
if self:CheckRotate(go2, combat.Orientation) then
|
|
|
|
|
offset = -offset
|
|
|
|
|
end
|
|
|
|
|
go2.transform.localPosition = Vector3.zero
|
|
|
|
|
go2.transform.anchoredPosition = offset
|
2021-06-09 18:11:07 +08:00
|
|
|
|
go2.transform.localScale = Vector3.one
|
2023-09-18 15:41:32 +08:00
|
|
|
|
go2.transform:SetParent(self.effectRoot.transform)
|
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
go2:SetActive(true)
|
2023-09-18 15:41:32 +08:00
|
|
|
|
local compnet=go2:GetComponent("SkeletonGraphic")
|
|
|
|
|
if compnet~=nil then
|
|
|
|
|
-- compnet.transform.localScale = Vector3.one * 3
|
|
|
|
|
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
|
|
|
|
|
self.owner:PlaySpineAnim (compnet,0,"animation",true)
|
|
|
|
|
end
|
|
|
|
|
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.BulletTime==0 and 4 or combat.BulletTime/1000)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 全屏特效屏幕中心
|
|
|
|
|
elseif combat.EffectType == 5 then
|
|
|
|
|
local offset = combat.Offset and Vector3.New(combat.Offset[1], combat.Offset[2], 0) or Vector3.zero
|
|
|
|
|
local sortingOrder = self.effectRoot:GetComponent("Canvas").sortingOrder
|
|
|
|
|
local go2 = BattleManager.LoadAsset(combat.Bullet, sortingOrder)
|
|
|
|
|
go2.transform:SetParent(self.effectRoot.transform)
|
|
|
|
|
-- 检测特效旋转
|
2023-08-04 18:58:14 +08:00
|
|
|
|
-- if self:CheckRotate(go2, combat.Orientation) then
|
|
|
|
|
-- offset = -offset
|
|
|
|
|
-- end
|
2020-11-01 15:46:48 +08:00
|
|
|
|
go2.transform.localScale = Vector3.one
|
|
|
|
|
go2.transform.localPosition = Vector3.zero
|
|
|
|
|
go2.transform.anchoredPosition = offset
|
|
|
|
|
go2:SetActive(true)
|
2023-08-04 18:58:14 +08:00
|
|
|
|
local compnet=go2:GetComponent("SkeletonGraphic")
|
|
|
|
|
if compnet~=nil then
|
2023-09-18 15:41:32 +08:00
|
|
|
|
-- compnet.transform.localScale = Vector3.one * 3
|
|
|
|
|
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
|
|
|
|
|
self.owner:PlaySpineAnim (compnet,0,"animation",true)
|
2023-08-04 18:58:14 +08:00
|
|
|
|
end
|
2023-09-18 15:41:32 +08:00
|
|
|
|
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, skillduration/1000)
|
2023-06-20 18:01:51 +08:00
|
|
|
|
|
2020-11-02 18:08:24 +08:00
|
|
|
|
|
|
|
|
|
-- 会自己动的指定目标特效
|
|
|
|
|
elseif combat.EffectType == 6 then
|
2023-09-18 15:41:32 +08:00
|
|
|
|
--可以替换成使用弹道使用!
|
2020-11-02 18:08:24 +08:00
|
|
|
|
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
|
2020-11-19 15:44:23 +08:00
|
|
|
|
|
|
|
|
|
local sortingOrder = self.effectRoot:GetComponent("Canvas").sortingOrder
|
2020-11-02 18:08:24 +08:00
|
|
|
|
local go2 = BattleManager.LoadAsset(combat.Bullet, sortingOrder)
|
|
|
|
|
go2.transform:SetParent(tv.GameObject.transform.parent)
|
|
|
|
|
-- 检测特效旋转
|
|
|
|
|
if self:CheckRotate(go2, combat.Orientation) then
|
|
|
|
|
offset = -offset
|
|
|
|
|
end
|
2023-09-18 15:41:32 +08:00
|
|
|
|
go2.transform.localPosition = Vector3.zero
|
2020-11-02 18:08:24 +08:00
|
|
|
|
go2.transform.anchoredPosition = offset
|
|
|
|
|
go2.transform:SetParent(self.effectRoot.transform)
|
2021-06-09 18:11:07 +08:00
|
|
|
|
go2.transform.localScale = Vector3.one
|
2020-11-02 18:08:24 +08:00
|
|
|
|
go2:SetActive(true)
|
|
|
|
|
--
|
|
|
|
|
local targetPos = go2.transform.localPosition
|
2023-09-18 15:41:32 +08:00
|
|
|
|
local startPos = targetPos + Vector3.New(400, 0, 0)
|
2020-11-02 18:08:24 +08:00
|
|
|
|
go2.transform.localPosition = startPos
|
2023-09-18 15:41:32 +08:00
|
|
|
|
go2.transform:DOLocalMove(targetPos, skillduration/1000, false)
|
|
|
|
|
local compnet=go2:GetComponent("SkeletonGraphic")
|
|
|
|
|
if compnet~=nil then
|
|
|
|
|
-- compnet.transform.localScale = Vector3.one * 3
|
|
|
|
|
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
|
|
|
|
|
self.owner:PlaySpineAnim (compnet,0,"animation",true)
|
|
|
|
|
end
|
|
|
|
|
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, skillduration/1000)
|
2020-11-02 18:08:24 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2023-09-18 15:41:32 +08:00
|
|
|
|
-- 射线特效(丢子弹?)
|
2020-11-17 18:31:11 +08:00
|
|
|
|
elseif combat.EffectType == 7 then
|
|
|
|
|
|
2023-07-06 14:08:10 +08:00
|
|
|
|
|
2020-11-17 18:31:11 +08:00
|
|
|
|
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
|
2020-11-19 15:44:23 +08:00
|
|
|
|
|
|
|
|
|
local sortingOrder = self.effectRoot:GetComponent("Canvas").sortingOrder
|
2020-11-17 18:31:11 +08:00
|
|
|
|
local go2 = BattleManager.LoadAsset(combat.Bullet, sortingOrder)
|
|
|
|
|
go2.transform:SetParent(self.owner.GameObject.transform.parent)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 检测特效旋转
|
2023-09-18 15:41:32 +08:00
|
|
|
|
|
2020-11-17 18:31:11 +08:00
|
|
|
|
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)
|
2023-06-20 18:01:51 +08:00
|
|
|
|
go2.transform.localEulerAngles = go2.transform.localEulerAngles+fixRotate
|
2020-11-17 18:31:11 +08:00
|
|
|
|
-- 缩放
|
|
|
|
|
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)
|
2023-09-18 15:41:32 +08:00
|
|
|
|
local compnet=go2:GetComponent("SkeletonGraphic")
|
|
|
|
|
if compnet~=nil then
|
|
|
|
|
-- compnet.transform.localScale = Vector3.one * 3
|
|
|
|
|
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
|
|
|
|
|
self.owner:PlaySpineAnim (compnet,0,"animation",true)
|
|
|
|
|
end
|
2020-11-17 18:31:11 +08:00
|
|
|
|
--
|
2023-09-18 15:41:32 +08:00
|
|
|
|
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.BulletTime/1000 + 0.2) -- 额外增加0.2秒显示时间
|
2020-11-17 18:31:11 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
2023-07-06 14:08:10 +08:00
|
|
|
|
--近战特效
|
2023-07-13 14:38:34 +08:00
|
|
|
|
-- elseif combat.EffectType == 8 then
|
|
|
|
|
|
|
|
|
|
-- local targets = skill:GetDirectTargets()
|
|
|
|
|
-- LogError(#targets.."|||||||||||")
|
|
|
|
|
-- -- 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 = self.effectRoot:GetComponent("Canvas").sortingOrder
|
|
|
|
|
-- -- -- local go2 = BattleManager.LoadAsset(combat.CloseRangeHit, 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
|
|
|
|
|
-- -- -- go2.transform.localScale=Vector3.New(0.01,0.01,0)
|
|
|
|
|
-- -- -- -- 特效旋转补正
|
|
|
|
|
-- -- -- 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)
|
|
|
|
|
-- -- -- go2.transform.localScale=Vector3.New(0.01,0.01,0)
|
|
|
|
|
|
|
|
|
|
-- -- -- --
|
|
|
|
|
-- -- -- BattleManager.AddDelayRecycleRes(combat.CloseRangeHit, go2, combat.KeyFrame/1000 + 0.2) -- 额外增加0.2秒显示时间
|
|
|
|
|
-- -- -- end
|
|
|
|
|
|
|
|
|
|
-- -- end
|
|
|
|
|
-- local tv = self.owner.RootPanel.GetRoleView(targets[1])
|
|
|
|
|
-- if tv then
|
|
|
|
|
-- local offset = combat.Offset and Vector3.New(combat.Offset[1], combat.Offset[2], 0) or Vector3.zero
|
|
|
|
|
|
|
|
|
|
-- local sortingOrder = self.effectRoot:GetComponent("Canvas").sortingOrder
|
|
|
|
|
-- local go2 = BattleManager.LoadAsset(combat.CloseRangeHit, 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
|
|
|
|
|
-- go2.transform.localScale=Vector3.New(0.01,0.01,0)
|
|
|
|
|
-- -- 特效旋转补正
|
|
|
|
|
-- 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
|
|
|
|
|
|
|
|
|
|
-- local skillLive = go2:GetComponent("SkeletonGraphic")
|
|
|
|
|
-- -- local t= self.RoleLiveGOGraphic.SkeletonData.animations
|
|
|
|
|
-- skillLive.AnimationState:SetAnimation(0, "attack", true)
|
|
|
|
|
-- -- -- go2.transform.localScale = Vector3.New(1, sl, 1)
|
|
|
|
|
-- go2.transform.localScale=Vector3.New(0.01,0.01,0)
|
|
|
|
|
-- go2.transform.name="skillcaster"
|
|
|
|
|
-- -- go2
|
|
|
|
|
-- BattleManager.AddDelayRecycleRes(combat.CloseRangeHit, go2, 3000/1000) -- 额外增加0.2秒显示时间
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
-- end
|
|
|
|
|
end
|
2020-11-01 15:46:48 +08:00
|
|
|
|
|
|
|
|
|
-- 取消高亮
|
2023-09-18 15:41:32 +08:00
|
|
|
|
-- self.owner:DelayFunc(combat.KeyFrame/1000, function()
|
|
|
|
|
-- self:CheckSkillHitEffect("skill", combat, skill)
|
2021-11-25 15:43:10 +08:00
|
|
|
|
|
2023-09-18 15:41:32 +08:00
|
|
|
|
-- end)
|
2021-11-25 15:43:10 +08:00
|
|
|
|
|
2023-09-19 18:56:46 +08:00
|
|
|
|
-- 判断是否震屏
|
|
|
|
|
-- bulletTime +
|
|
|
|
|
if combat.ShockScreen == 1 then
|
|
|
|
|
self.owner:DelayFunc((combat.KeyFrame + combat.DamageDelay)/1000, function()
|
|
|
|
|
self:checkShake(combat)
|
|
|
|
|
end)
|
|
|
|
|
end
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-11-17 18:31:11 +08:00
|
|
|
|
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
|
|
|
|
|
|
2023-06-20 18:01:51 +08:00
|
|
|
|
local deltaR = math.atan(math.abs(deltaY/deltaX))/math.pi*180
|
|
|
|
|
--camp==1是enmey,camp==0是player
|
|
|
|
|
if baseRole.camp == 0 and deltaY > 0 then
|
2020-11-17 18:31:11 +08:00
|
|
|
|
return Vector3.New(0, 0, deltaR)
|
2023-06-20 18:01:51 +08:00
|
|
|
|
elseif baseRole.camp == 0 and deltaY < 0 then
|
2020-11-17 18:31:11 +08:00
|
|
|
|
return Vector3.New(0, 0, -deltaR)
|
2023-06-20 18:01:51 +08:00
|
|
|
|
elseif baseRole.camp == 1 and deltaY < 0 then
|
2020-11-17 18:31:11 +08:00
|
|
|
|
return Vector3.New(0, 0, deltaR)
|
2023-06-20 18:01:51 +08:00
|
|
|
|
elseif baseRole.camp == 1 and deltaY > 0 then
|
|
|
|
|
return Vector3.New(0, 0, -deltaR)
|
2020-11-17 18:31:11 +08:00
|
|
|
|
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
|
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 检测前摇技能释放
|
|
|
|
|
function SkillCaster:CheckSkillForoleEffect(combat, skill)
|
|
|
|
|
if not skill then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if not combat.BeforeBullet or combat.BeforeBullet == "" then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local go
|
|
|
|
|
local path = combat.BeforeBullet
|
|
|
|
|
local offset = combat.BeforeOffset and Vector3.New(combat.BeforeOffset[1], combat.BeforeOffset[2], 0) or Vector3.zero
|
2020-11-02 23:19:52 +08:00
|
|
|
|
local pos = Vector3.zero
|
2020-11-01 15:46:48 +08:00
|
|
|
|
|
|
|
|
|
-- 挂在人身上,以人物中心为原点
|
|
|
|
|
if combat.BeforeEffectType == 1 then
|
2020-11-02 11:54:48 +08:00
|
|
|
|
if self.owner.role.type == BattleUnitType.Role then
|
|
|
|
|
local sortingOrder
|
2021-11-25 14:46:46 +08:00
|
|
|
|
if self.owner.camp == 0 then
|
2020-11-02 11:54:48 +08:00
|
|
|
|
sortingOrder = self.owner.GameObject:GetComponent("Canvas").sortingOrder
|
2020-11-11 18:10:06 +08:00
|
|
|
|
else
|
|
|
|
|
sortingOrder = BattleManager.GetBattleSorting() + 20
|
2020-11-02 11:54:48 +08:00
|
|
|
|
end
|
|
|
|
|
go = BattleManager.LoadAsset(path, sortingOrder)
|
2023-06-20 18:01:51 +08:00
|
|
|
|
go.transform:SetParent(self.owner.RoleLiveGO.transform)
|
2023-04-06 14:02:32 +08:00
|
|
|
|
elseif self.owner.role.type == BattleUnitType.Monster then
|
2020-11-02 11:54:48 +08:00
|
|
|
|
go = BattleManager.LoadAsset(path)
|
|
|
|
|
go.transform:SetParent(self.owner.RoleLiveGO2.gameObject.transform)
|
2023-04-06 14:02:32 +08:00
|
|
|
|
elseif self.owner.role.type == BattleUnitType.Weapon then
|
|
|
|
|
go = BattleManager.LoadAsset(path)
|
|
|
|
|
go.transform:SetParent(self.owner.GameObject.transform)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
2020-11-02 11:54:48 +08:00
|
|
|
|
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 屏幕中心
|
|
|
|
|
elseif combat.BeforeEffectType == 2 then
|
|
|
|
|
local sortingOrder = self.effectRoot:GetComponent("Canvas").sortingOrder
|
|
|
|
|
go = BattleManager.LoadAsset(path, sortingOrder)
|
|
|
|
|
go.transform:SetParent(self.effectRoot.transform)
|
2020-11-02 23:19:52 +08:00
|
|
|
|
|
|
|
|
|
-- 根据目标位置
|
|
|
|
|
elseif combat.BeforeEffectType == 3 then
|
|
|
|
|
pos = self:GetEffectPosition(skill)
|
|
|
|
|
go = BattleManager.LoadAsset(path, self.effectRoot:GetComponent("Canvas").sortingOrder)
|
|
|
|
|
go.transform:SetParent(self.effectRoot.transform)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 检测特效旋转
|
|
|
|
|
if self:CheckRotate(go, combat.BeforeOrientation) then
|
|
|
|
|
offset = -offset
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
go.transform.localScale = Vector3.one
|
|
|
|
|
go.transform.localPosition = Vector3.zero
|
2020-11-02 23:19:52 +08:00
|
|
|
|
go.transform.anchoredPosition = offset + pos
|
2020-11-01 15:46:48 +08:00
|
|
|
|
go:SetActive(true)
|
|
|
|
|
BattleManager.AddDelayRecycleRes(path, go, 4)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 检测技能命中特效显示
|
|
|
|
|
function SkillCaster:CheckSkillHitEffect(checkType, combat, skill)
|
|
|
|
|
if not combat then return end
|
|
|
|
|
if checkType == "skill" then
|
|
|
|
|
-- 释放技能时检测,如果是范围命中效果
|
|
|
|
|
if combat.HitEffectType == 2 and combat.Hit then
|
|
|
|
|
local targets = skill:GetDirectTargets()
|
2020-11-11 18:10:06 +08:00
|
|
|
|
if not targets or not targets[1] then return end -- or targets[1]:IsDead() 删除了死亡的判断,会偶现被击特效不显示的问题
|
2020-11-01 15:46:48 +08:00
|
|
|
|
local tv = self.owner.RootPanel.GetRoleView(targets[1])
|
|
|
|
|
if not tv then return end
|
|
|
|
|
local tpos = self:GetEffectPosition(skill)
|
|
|
|
|
if not tpos then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- 特效的偏移量
|
|
|
|
|
local offset = combat.HitOffset and Vector3.New(combat.HitOffset[1], combat.HitOffset[2], 0) or Vector3.zero
|
|
|
|
|
|
2020-11-11 18:10:06 +08:00
|
|
|
|
local sortingOrder = tv.role.camp == 0 and tv.GameObject:GetComponent("Canvas").sortingOrder + 21 or BattleManager.GetBattleSorting() + 20
|
2020-11-01 15:46:48 +08:00
|
|
|
|
local go = BattleManager.LoadAsset(combat.Hit, sortingOrder)
|
|
|
|
|
go.transform:SetParent(self.effectRoot.transform)
|
|
|
|
|
-- 检测特效旋转
|
|
|
|
|
if self:CheckRotate(go, combat.HitOrientation) then
|
|
|
|
|
offset = -offset
|
|
|
|
|
end
|
|
|
|
|
go.transform.localScale = Vector3.one
|
|
|
|
|
go.transform.localPosition = tpos + offset
|
|
|
|
|
go:SetActive(true)
|
|
|
|
|
BattleManager.AddDelayRecycleRes(combat.Hit, go, 5)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
elseif checkType == "hit" then
|
|
|
|
|
-- 被击中时检测,如果是目标命中
|
|
|
|
|
if combat.HitEffectType == 1 and combat.Hit then
|
|
|
|
|
local offset = combat.HitOffset and Vector3.New(combat.HitOffset[1], combat.HitOffset[2], 0) or Vector3.zero
|
|
|
|
|
|
2020-11-11 18:10:06 +08:00
|
|
|
|
local sortingOrder = self.owner.role.camp == 0 and self.owner.GameObject:GetComponent("Canvas").sortingOrder + 21 or BattleManager.GetBattleSorting() + 20
|
2020-11-01 15:46:48 +08:00
|
|
|
|
local go2 = BattleManager.LoadAsset(combat.Hit, sortingOrder)
|
2021-06-09 17:09:39 +08:00
|
|
|
|
go2.transform:SetParent(self.owner.GameObject.transform.parent)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
-- 检测特效旋转
|
|
|
|
|
if self:CheckRotate(go2, combat.HitOrientation) then
|
|
|
|
|
offset = -offset
|
|
|
|
|
end
|
|
|
|
|
go2.transform.localPosition = Vector3.zero--self.GameObject.transform.localPosition + Vector3.New(0, self.BuffFloatingCount * 180, 0)
|
|
|
|
|
go2.transform.anchoredPosition = offset--Vector2.zero
|
2021-06-09 17:09:39 +08:00
|
|
|
|
go2.transform:SetParent(self.effectRoot.transform)
|
|
|
|
|
go2.transform.localScale = Vector3.one
|
2020-11-01 15:46:48 +08:00
|
|
|
|
go2:SetActive(true)
|
|
|
|
|
BattleManager.AddDelayRecycleRes(combat.Hit, go2, 5)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 检测是否需要震动屏幕
|
|
|
|
|
function SkillCaster:checkShake(combat)
|
|
|
|
|
if combat.ShockScreen == 1 then
|
|
|
|
|
self.owner.RootPanel:SetShake()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--弹道轨迹
|
|
|
|
|
local plist = {
|
|
|
|
|
[1] = {
|
|
|
|
|
Vector2.New(0.2, 0.9),
|
|
|
|
|
},
|
|
|
|
|
[2] = {
|
2021-11-24 14:29:47 +08:00
|
|
|
|
Vector2.New(1, 0.33),
|
|
|
|
|
Vector2.New(0, 0.67),
|
2020-11-01 15:46:48 +08:00
|
|
|
|
},
|
|
|
|
|
[3] = {
|
|
|
|
|
Vector2.New(0.9, 0.2),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- 播放弹道特效
|
|
|
|
|
function SkillCaster:RoleViewBullet(combat, target)
|
|
|
|
|
|
|
|
|
|
if not self.owner.RootPanel.GetRoleView(target) then return end
|
|
|
|
|
if not combat then return end
|
|
|
|
|
|
|
|
|
|
local duration = combat.BulletTime/1000
|
|
|
|
|
local bulletEffect = combat.Bullet
|
|
|
|
|
if not bulletEffect or bulletEffect == "" or duration == 0 then return end
|
|
|
|
|
|
2023-09-18 15:41:32 +08:00
|
|
|
|
local go = BattleManager.LoadSpineAsset(bulletEffect, self.effectRoot.transform)
|
2021-11-23 17:23:35 +08:00
|
|
|
|
self:CheckRotate(go, combat.Orientation)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
go.transform:SetParent(self.effectRoot.transform)
|
|
|
|
|
go.transform.localScale = Vector3.one
|
|
|
|
|
go.transform.position = self.owner.GameObject.transform.position
|
|
|
|
|
Util.ClearTrailRender(go)
|
|
|
|
|
go:SetActive(true)
|
|
|
|
|
|
2021-11-24 14:29:47 +08:00
|
|
|
|
-- local startV3 = go.transform.position
|
|
|
|
|
-- local endV3 = self.owner.RootPanel.GetRoleView(target).GameObject.transform.position
|
|
|
|
|
|
|
|
|
|
-- 特效旋转补正
|
|
|
|
|
local tv = self.owner.RootPanel.GetRoleView(target)
|
|
|
|
|
|
|
|
|
|
local startPos = go.transform.position
|
|
|
|
|
local targetPos = tv.GameObject.transform.position
|
|
|
|
|
|
|
|
|
|
local deltaX = targetPos.x - startPos.x
|
|
|
|
|
local deltaY = targetPos.y - startPos.y
|
|
|
|
|
local deltaR = math.atan(math.abs(deltaX/deltaY))/math.pi*180
|
|
|
|
|
|
|
|
|
|
local fixRotate = self:CalRoleRotate(self.owner, tv)
|
|
|
|
|
go.transform.localEulerAngles = go.transform.localEulerAngles + fixRotate
|
2023-09-18 15:41:32 +08:00
|
|
|
|
local compnet=go:GetComponent("SkeletonGraphic")
|
|
|
|
|
if compnet~=nil then
|
|
|
|
|
--compnet.transform.localScale = Vector3.one * 3
|
|
|
|
|
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
|
2023-09-19 18:56:46 +08:00
|
|
|
|
self.owner:PlaySpineAnim (compnet,0,"attack",true)
|
2023-09-18 15:41:32 +08:00
|
|
|
|
end
|
2021-11-24 14:29:47 +08:00
|
|
|
|
|
|
|
|
|
-- go.transform.localPosition = startPos
|
2023-09-18 15:41:32 +08:00
|
|
|
|
go.transform:DOMove(targetPos, combat.BulletTime/1000, false):OnComplete(function ()
|
2020-11-01 15:46:48 +08:00
|
|
|
|
poolManager:UnLoadAsset(bulletEffect, go, PoolManager.AssetType.GameObject)
|
|
|
|
|
end)
|
2021-11-24 14:29:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- local startV2 = Vector2.New(0, 0)
|
|
|
|
|
-- local endV2 = Vector2.New(1, 1)
|
|
|
|
|
|
|
|
|
|
-- local pL = plist[math.random(1, #plist)]
|
|
|
|
|
-- --飞行子弹轨迹
|
|
|
|
|
-- DoTween.To(
|
|
|
|
|
-- DG.Tweening.Core.DOGetter_float( function () return 0 end),
|
|
|
|
|
-- DG.Tweening.Core.DOSetter_float(function (progress)
|
|
|
|
|
-- local v2 = Bezier.CalPos(progress, startV2, endV2, pL)
|
|
|
|
|
|
|
|
|
|
-- local targetPos = Vector3.New(startV3.x * (1-v2.x) + endV3.x * v2.x, startV3.y * (1-v2.y) + endV3.y * v2.y, startV3.z)
|
|
|
|
|
-- local basePos = go.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
|
|
|
|
|
|
|
|
|
|
-- go.transform.localEulerAngles = Vector3.New(0, 0, deltaR)
|
|
|
|
|
|
|
|
|
|
-- go.transform.position = targetPos
|
|
|
|
|
|
|
|
|
|
-- end), 1, duration)
|
|
|
|
|
-- -- :SetEase(Ease.InQuad)
|
|
|
|
|
-- :OnComplete(function ()
|
|
|
|
|
-- poolManager:UnLoadAsset(bulletEffect, go, PoolManager.AssetType.GameObject)
|
|
|
|
|
-- end)
|
2020-11-01 15:46:48 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return SkillCaster
|