SK_LongZhu
DESKTOP-RH64908\Administrator 2025-08-19 18:24:03 +08:00
parent d5e5b30b4a
commit ce3f739698
1 changed files with 425 additions and 427 deletions

View File

@ -1,13 +1,12 @@

local Bezier = require("Base.Bezier")
local Bezier = require("Base.Bezier")
local SkillLogicConfig = ConfigManager.GetConfig(ConfigName.SkillLogicConfig)
local BuffEffectConfig = ConfigManager.GetConfig(ConfigName.BuffEffectConfig)
local skillConfig=ConfigManager.GetConfig(ConfigName.SkillConfig)
local skillConfig = ConfigManager.GetConfig(ConfigName.SkillConfig)
SkillCaster = {}
function SkillCaster.New(unit, actionTime, soundTime, soundName, castingEfectNode, castingNameNode)
local o = {}
setmetatable(o, {__index = SkillCaster})
setmetatable(o, { __index = SkillCaster })
o:ctor(unit, actionTime, soundTime, soundName, castingEfectNode, castingNameNode)
return o
end
@ -21,7 +20,7 @@ function SkillCaster:ctor(unit, actionTime, soundTime, soundName, castingEfectNo
self.castingEfectNode = castingEfectNode -- cast特效资源
self.castingNameNode = castingNameNode -- cast名称资源
self.effectRoot = self.owner.RootPanel.skillEffectRoot
self.roleConfig=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,unit.roleId)
self.roleConfig = ConfigManager.TryGetConfigData(ConfigName.RoleConfig, unit.roleId)
--
self.owner.role.Event:AddEvent(BattleEventName.SkillCast, self.OnSkillCast, self)
end
@ -36,11 +35,11 @@ function SkillCaster:OnSkillCast(skill)
if skill.isAdd then
self.owner.Floater:ImageBuffFloating("z_zhandou_zhuiji_zh")
end
if self.owner.RoleLiveGO==nil then
if self.owner.RoleLiveGO == nil then
LogError("当前角色没有spine动画")
-- return
end
local startPos=self.owner.startPos
local startPos = self.owner.startPos
-- 高亮
-- LogError("Start"..os.date())
BattleManager.PauseBattle()
@ -56,12 +55,12 @@ function SkillCaster:OnSkillCast(skill)
if IsNull(self.owner.GameObject) then
return
end
local localtype=0
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
local localtype = 0
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
-- type=1
-- self.actionTime=self.roleConfig.ReadyAction/1000
end
localtype=skill.type==BattleSkillType.Special and BattleSkillType.Special or 0
localtype = skill.type == BattleSkillType.Special and BattleSkillType.Special or 0
-- if self.owner.role.readyAction~=0 then
-- self.actionTime=self.owner.role.readyAction/1000
@ -71,78 +70,82 @@ function SkillCaster:OnSkillCast(skill)
-- self.owner:OnSkillPlay(type)
-- end
--self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder+50
if self.owner.RoleLiveGO and combat.AttackDisplacement ==1 then
local displaceoffset={[1]=0.4,[2]=-0.2}
if self.owner.RoleLiveGO and combat.AttackDisplacement == 1 then
local displaceoffset = { [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 and type(skill.AttackDisplaceOffset[1])~="userdata" then
displaceoffset=skill.AttackDisplaceOffset
if skill.AttackDisplaceOffset and type(skill.AttackDisplaceOffset[1]) ~= "userdata" then
displaceoffset = skill.AttackDisplaceOffset
end
self.owner.GameObject:SetActive(false)
local targets = skill:GetDirectTargets()
LogError( tostring(self:GetMovePosition(skill)))
LogError( "最大目标"..tostring(skill:GetMaxTargetNum()))
if skill:GetMaxTargetNum() >1 then
local postion= self:GetMovePosition(skill)
local posx=0
local posy=0
if displaceoffset and #displaceoffset>0 then
if displaceoffset[1] and type(displaceoffset[1]) ~="userdata" then
posx=displaceoffset[1]
LogError(tostring(self:GetMovePosition(skill)))
LogError("最大目标" .. tostring(skill:GetMaxTargetNum()))
if skill:GetMaxTargetNum() > 1 then
local postion = self:GetMovePosition(skill)
local posx = 0
local posy = 0
if displaceoffset and #displaceoffset > 0 then
if displaceoffset[1] and type(displaceoffset[1]) ~= "userdata" then
posx = displaceoffset[1]
end
if displaceoffset[2] and type(displaceoffset[2]) ~="userdata" then
posy=displaceoffset[2]
if displaceoffset[2] and type(displaceoffset[2]) ~= "userdata" then
posy = displaceoffset[2]
end
end
--LogError(tostring(postion))
--LogError(tostring(Vector3.New(postion.x-(self.owner.camp==0 and posx or(-posx)),postion.y+posy,postion.z)))
LogError("===========================:"..self.owner.RoleLiveGO.name)
self.owner.RoleLiveGO.transform:DOMove(Vector3.New(postion.x-(self.owner.camp==0 and posx or(-posx)),postion.y+posy,startPos.z), combat.AttackDisplaceTime/1000, false):OnComplete(function ()
LogError("===========================:" .. self.owner.RoleLiveGO.name)
self.owner.RoleLiveGO.transform:DOMove(
Vector3.New(postion.x - (self.owner.camp == 0 and posx or (-posx)), postion.y + posy, startPos.z),
combat.AttackDisplaceTime / 1000, false):OnComplete(function()
local Canvas = self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas")
if Canvas==nil then
if Canvas == nil then
Canvas = self.owner.RoleLiveGO.transform.parent.parent.gameObject:GetComponent("Canvas")
end
Canvas.sortingOrder= Canvas.sortingOrder+50
Canvas.sortingOrder = Canvas.sortingOrder + 50
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype,combat)
self.owner:OnSkillPlay(localtype, combat)
end
end)
else
for _, target in ipairs(targets) do
local t= self.owner.RootPanel.GetRoleView(target)
local posx=0
local posy=0
if displaceoffset and #displaceoffset>0 then
if displaceoffset[1] and type(displaceoffset[1]) ~="userdata" then
posx=displaceoffset[1]
local t = self.owner.RootPanel.GetRoleView(target)
local posx = 0
local posy = 0
if displaceoffset and #displaceoffset > 0 then
if displaceoffset[1] and type(displaceoffset[1]) ~= "userdata" then
posx = displaceoffset[1]
end
if displaceoffset[2] and type(displaceoffset[2]) ~="userdata" then
posy=displaceoffset[2]
if displaceoffset[2] and type(displaceoffset[2]) ~= "userdata" then
posy = displaceoffset[2]
end
end
--LogError("技能位移Id"..combat.Id.."开始时间"..os.date())
LogError("技能位移Id"..combat.Id.."开始时间"..self.owner.RoleLiveGO.name)
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 ()
self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder+50
LogError("技能位移Id" .. combat.Id .. "开始时间" .. self.owner.RoleLiveGO.name)
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()
self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder = self
.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder + 50
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype,combat)
self.owner:OnSkillPlay(localtype, combat)
--LogError("技能位移Id"..combat.Id.."结束时间"..os.date())
end
end)
end
end
else
if self.owner.RoleLiveGO and self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype,combat)
self.owner:OnSkillPlay(localtype, combat)
end
end
-- 播放
@ -179,24 +182,24 @@ function SkillCaster:OnSkillCast(skill)
-- end
if self.owner.role.type == BattleUnitType.Role then
if combat.BeforeEffectDelay then
self.owner:DelayFunc(combat.BeforeEffectDelay/1000, function()
self.owner:DelayFunc(combat.BeforeEffectDelay / 1000, function()
self:CheckSkillForoleEffect(combat, skill)
end)
else
self:CheckSkillForoleEffect(combat, skill)
end
end
--self.actionTime换成combatactiontime
local skillduration=600
self.owner:DelayFunc(combat.ShankTime/1000, function()
self:CheckFullSceenSkill(combat, skill,skillduration)
local skillduration = 600
self.owner:DelayFunc(combat.ShankTime / 1000, function()
self:CheckFullSceenSkill(combat, skill, skillduration)
end)
-- LogError("Time点2"..os.date())
-- LogError("Time点2.5"..os.date())
self.owner:DelayFunc(combat.ActionTime/1000+0+(combat.EffectType==8 and 0 or combat.BulletTime/1000), function()
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()
-- LogError("ActionTime"..combat.ActionTime/1000)
-- 继续战斗放在特效加载之后,避免特效加载时间对战斗时间得影响
@ -205,30 +208,39 @@ function SkillCaster:OnSkillCast(skill)
self:checkShake(combat)
end
-- 取消高亮
self.owner:DelayFunc((combat.SkillDuration)/1000, function()
self.owner:DelayFunc((combat.SkillDuration) / 1000, function()
-- 恢复高亮
self.owner.RootPanel.SetRoleHighLight()
-- 调用上层接口
if self.owner.RoleLiveGO and combat.AttackDisplacement ==1 then
LogError("技能返回位移Id"..combat.Id.."开始时间"..os.date().."=="..self.owner.RoleLiveGO.name)
self.owner:DelayFunc(combat.AttackDisplaceBackTime/1000+((type(combat.SkillNumbetTime[1][1]) == "userdata" or combat.SkillNumbetTime[1][1]==0) and 0 or combat.SkillNumbetTime[#combat.SkillNumbetTime][2])/1000, function()
self.owner.RoleLiveGO.transform:DOMove(startPos, combat.AttackDisplaceTime/1000, false):OnComplete(function ()
LogError("技能返回位移Id"..combat.Id.."开始时间"..os.date().."=="..self.owner.RoleLiveGO.name)
local Canvas = self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas")
if Canvas==nil then
Canvas = self.owner.RoleLiveGO.transform.parent.parent.gameObject:GetComponent("Canvas")
if self.owner.RoleLiveGO and combat.AttackDisplacement == 1 then
LogError("技能返回位移Id" .. combat.Id .. "开始时间" .. os.date() .. "==" .. self.owner.RoleLiveGO
.name)
self.owner:DelayFunc(
combat.AttackDisplaceBackTime / 1000 +
((type(combat.SkillNumbetTime[1][1]) == "userdata" or combat.SkillNumbetTime[1][1] == 0) and 0 or combat.SkillNumbetTime[#combat.SkillNumbetTime][2]) /
1000, function()
self.owner.RoleLiveGO.transform:DOMove(startPos, combat.AttackDisplaceTime / 1000,
false)
:OnComplete(function()
LogError("技能返回位移Id" ..
combat.Id .. "开始时间" .. os.date() .. "==" .. self.owner.RoleLiveGO.name)
local Canvas = self.owner.RoleLiveGO.transform.parent.gameObject
:GetComponent(
"Canvas")
if Canvas == nil then
Canvas = self.owner.RoleLiveGO.transform.parent.parent.gameObject
:GetComponent("Canvas")
end
Canvas.sortingOrder = Canvas.sortingOrder-50
Canvas.sortingOrder = Canvas.sortingOrder - 50
self.owner.GameObject:SetActive(true)
LogError("技能返回位移Id"..combat.Id.."结束时间"..os.date())
LogError("技能返回位移Id" .. combat.Id .. "结束时间" .. os.date())
--self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder-50
if self.owner.OnSkillEnd then
self.owner:OnSkillEnd()
end
end)
end)
else
--self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder-50
@ -252,17 +264,11 @@ function SkillCaster:OnSkillCast(skill)
elseif combat.VerticalDrawing == 2 then
self:PlaySkillCastingEffect(combat, skill, function()
_PlaySkill()
end)
end
end)
end
function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
-- 播放casting
self.castingEfectNode:SetActive(false)
@ -271,9 +277,9 @@ function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
SoundManager.PlaySound(SoundConfig.Sound_RoleCasting)
--if combat.skillname and combat.skillname ~= "" then
self.castingNameNode:SetActive(true)
local name=""
local name = ""
if skillConfig[combat.Id] then
name=skillConfig[combat.Id].Name
name = skillConfig[combat.Id].Name
end
-- LogError("name============================================="..name)
self.castingNameNode:GetComponent("Text").text = name --self.spLoader:LoadSprite(combat.skillname)
@ -289,7 +295,7 @@ function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
-- 这里相当于技能前摇,等待立绘播放到需要释放关键帧的时间时继续释放技能(灵兽前摇特效)
if self.owner.role.type == BattleUnitType.Monster or self.owner.role.type == BattleUnitType.Weapon then
if combat.BeforeEffectDelay then
self.owner:DelayFunc(combat.BeforeEffectDelay/1000, function()
self.owner:DelayFunc(combat.BeforeEffectDelay / 1000, function()
self:CheckSkillForoleEffect(combat, skill)
end)
else
@ -301,12 +307,12 @@ function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
self.owner:OnSkillCastStart(skill)
end
-- 调用上层接口
local type=0
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
type=1
local type = 0
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
type = 1
end
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
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
local _ExtraTime
if self.owner.OnSkillCastingStart then
@ -316,7 +322,7 @@ function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
self.owner:DelayFunc(2, function()
-- 判断是否要额外增加casting显示时间
self.owner:DelayFunc(_ExtraTime, function ()
self.owner:DelayFunc(_ExtraTime, function()
self.castingEfectNode:SetActive(false)
-- 调用上层接口
if self.owner.OnSkillCastingEnd then
@ -324,13 +330,13 @@ function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
end
end)
if func then func() func = nil end
if func then
func()
func = nil
end
end)
end
--横版需要改动
local FullEffectPosition = {
-- My_All = Vector3.New(0, -566, 0),
@ -358,26 +364,26 @@ local FullEffectPosition = {
Enemy_All = Vector3.New(50, 0, 0),
Enemy_Front = Vector3.New(0, 0, 0),
Enemy_Behind = Vector3.New(150,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),
}
local MoveMentPosition = {
My_All = Vector3.New(0,-1.3, 0),
My_Front = Vector3.New(0,-1.3, 0),
My_Behind = Vector3.New(-1,-1.5 , 0),
My_COL_1 = Vector3.New(0.5,-0.7, 0),
My_COL_2 = Vector3.New(0.5,-1.5, 0),
My_COL_3 = Vector3.New(0.5,-2.8, 0),
My_All = Vector3.New(0, -1.3, 0),
My_Front = Vector3.New(0, -1.3, 0),
My_Behind = Vector3.New(-1, -1.5, 0),
My_COL_1 = Vector3.New(0.5, -0.7, 0),
My_COL_2 = Vector3.New(0.5, -1.5, 0),
My_COL_3 = Vector3.New(0.5, -2.8, 0),
Enemy_All = Vector3.New(0,-1.3, 0), --全部
Enemy_Front = Vector3.New(0,-1.3, 0),--前面一列
Enemy_Behind = Vector3.New(1,-1.5 , 0), --后面一列
Enemy_COL_1 = Vector3.New(-0.5,-0.7, 0),--第一行
Enemy_COL_2 = Vector3.New(-0.5,-1.5, 0),--第二行
Enemy_COL_3 = Vector3.New(-0.5,-2.8, 0),--第三行
Enemy_All = Vector3.New(0, -1.3, 0), --全部
Enemy_Front = Vector3.New(0, -1.3, 0), --前面一列
Enemy_Behind = Vector3.New(1, -1.5, 0), --后面一列
Enemy_COL_1 = Vector3.New(-0.5, -0.7, 0), --第一行
Enemy_COL_2 = Vector3.New(-0.5, -1.5, 0), --第二行
Enemy_COL_3 = Vector3.New(-0.5, -2.8, 0), --第三行
}
function SkillCaster:GetEffectPosition(skill)
@ -388,15 +394,15 @@ function SkillCaster:GetEffectPosition(skill)
local targetPos = targets[1].position
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]
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
return FullEffectPosition.My_All
end
function SkillCaster:GetMovePosition(skill)
function SkillCaster:GetMovePosition(skill)
local chooseId = skill:GetDirectChooseId()
local chooseLimit = math.floor(chooseId / 10000) % 10
local targets = skill:GetDirectTargets()
@ -404,7 +410,7 @@ function SkillCaster:GetMovePosition(skill)
local targetCamp = targets[1].camp
local targetPos = targets[1].position
LogError("选择目标方式:"..tostring(chooseLimit))
LogError("选择目标方式:" .. tostring(chooseLimit))
if chooseLimit == 0 or chooseLimit == 4 or chooseLimit == 5 then
return targetCamp == 0 and MoveMentPosition.My_All or MoveMentPosition.Enemy_All
elseif chooseLimit == 1 or chooseLimit == 2 then --前排,后排
@ -413,32 +419,36 @@ function SkillCaster:GetMovePosition(skill)
local tv = self.owner.RootPanel.GetRoleView(target)
targetY = targetY + tv.GameObject.transform.position.y
end
targetY = targetY/#targets
targetY = targetY / #targets
if targetCamp == 0 then
if targetPos <= 3 then
return Vector3.New(MoveMentPosition.My_Front.x,targetY,MoveMentPosition.My_Front.z)
return Vector3.New(MoveMentPosition.My_Front.x, targetY, MoveMentPosition.My_Front.z)
else
return Vector3.New(MoveMentPosition.My_Behind.x,targetY,MoveMentPosition.My_Behind.z)
return Vector3.New(MoveMentPosition.My_Behind.x, targetY, MoveMentPosition.My_Behind.z)
end
--return targetPos <= 3 and MoveMentPosition.My_Front or MoveMentPosition.My_Behind
else
if targetPos <= 3 then
return Vector3.New(MoveMentPosition.Enemy_Front.x,targetY,MoveMentPosition.Enemy_Front.z)
return Vector3.New(MoveMentPosition.Enemy_Front.x, targetY, MoveMentPosition.Enemy_Front.z)
else
return Vector3.New(MoveMentPosition.Enemy_Behind.x,targetY,MoveMentPosition.Enemy_Behind.z)
return Vector3.New(MoveMentPosition.Enemy_Behind.x, targetY, MoveMentPosition.Enemy_Behind.z)
end
--return targetPos <= 3 and MoveMentPosition.Enemy_Front or MoveMentPosition.Enemy_Behind
end
elseif chooseLimit == 3 then --队列
local col = (targetPos-1) % 3 + 1
if targetPos <= 3 then
return targetCamp == 0 and MoveMentPosition["My_COL_"..col] or MoveMentPosition["Enemy_COL_"..col]
local eid = BattleManager.GetCombatIdBySkin(skill.id, self.owner.skinId)
local combat = BattleManager.GetSkillCombat(eid)
local col = (targetPos - 1) % 3 + 1
if targetPos <= 3 or combat.BeforeEffectType ~= 1 then
return targetCamp == 0 and MoveMentPosition["My_COL_" .. col] or MoveMentPosition["Enemy_COL_" .. col]
else
return targetCamp == 0 and (MoveMentPosition["My_COL_"..col] + Vector3.New(-1,0,0)) or (MoveMentPosition["Enemy_COL_"..col] + Vector3.New(1,0,0))
return targetCamp == 0 and (MoveMentPosition["My_COL_" .. col] + Vector3.New(-1, 0, 0)) or
(MoveMentPosition["Enemy_COL_" .. col] + Vector3.New(1, 0, 0))
end
end
return MoveMentPosition.My_All
end
-- function SkillCaster:GetSkillChooseLimit
-- 检测特效旋转
function SkillCaster:CheckRotate(go, orientation)
@ -454,7 +464,7 @@ function SkillCaster:CheckRotate(go, orientation)
-- end
-- :: Label ::
-- 判断是否旋转
if orientation==nil then
if orientation == nil then
-- body
return false
end
@ -463,14 +473,14 @@ function SkillCaster:CheckRotate(go, orientation)
rt = rt and Vector3.New(rt[1], rt[2], rt[3]) or Vector3.zero
if (self.owner.camp == 0 and isR == 1)
or (self.owner.camp == 1 and isR == 2) then
go.transform.localRotation = Quaternion.Euler(rt.x,rt.y,rt.z)
go.transform.localRotation = Quaternion.Euler(rt.x, rt.y, rt.z)
return true
end
go.transform.localRotation = Vector3.zero
end
-- 检测是否需要释放全屏技能
function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
function SkillCaster:CheckFullSceenSkill(combat, skill, skillduration)
if not skill then
return
end
@ -487,7 +497,6 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
elseif combat.EffectType == 2 then
local path = combat.Bullet
if path then
local pos = self:GetEffectPosition(skill)
if not pos then
return
@ -501,21 +510,19 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
if self:CheckRotate(go, combat.Orientation) then
offset = -offset
end
if go ~=nil then
if go ~= nil then
go.transform:SetParent(self.effectRoot.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = pos + offset
go:SetActive(true)
local compnet=go:GetComponent("SkeletonGraphic")
if compnet~=nil then
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,"play_skill_self",true)
self.owner:PlaySpineAnim(compnet, 0, "play_skill_self", true)
end
BattleManager.AddDelayRecycleRes(path, go, combat.BulletTime==0 and 4 or combat.BulletTime/1000)
BattleManager.AddDelayRecycleRes(path, go, combat.BulletTime == 0 and 4 or combat.BulletTime / 1000)
end
end
-- 全屏弹道特效
elseif combat.EffectType == 3 then
@ -528,18 +535,18 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
return
end
-- 时间
local duration = combat.BulletTime/1000
local duration = combat.BulletTime / 1000
-- 特效的偏移量
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 go ~=nil then
if go ~= nil then
go.transform:SetParent(self.effectRoot.transform)
local compnet=go:GetComponent("SkeletonGraphic")
if compnet~=nil then
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,"play_skill_self",true)
self.owner:PlaySpineAnim(compnet, 0, "play_skill_self", true)
end
-- 检测特效旋转
if self:CheckRotate(go, combat.Orientation) then
@ -568,7 +575,7 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
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.LoadSpineAsset(combat.Bullet,tv.GameObject.transform.parent )
local go2 = BattleManager.LoadSpineAsset(combat.Bullet, tv.GameObject.transform.parent)
go2.transform:SetParent(tv.GameObject.transform.parent)
-- 检测特效旋转
if self:CheckRotate(go2, combat.Orientation) then
@ -576,41 +583,41 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
end
go2.transform.localPosition = Vector3.zero
go2.transform.anchoredPosition = offset
go2.transform.localScale = Vector3.New(combat.HitScale[1]/1000,combat.HitScale[2]/1000,1)
go2.transform.localScale = Vector3.New(combat.HitScale[1] / 1000, combat.HitScale[2] / 1000, 1)
-- go2.transform:SetParent(self.effectRoot.transform)
go2:SetActive(true)
local compnet=go2:GetComponent("SkeletonGraphic")
if compnet~=nil then
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,"play_skill_self",true)
self.owner:PlaySpineAnim(compnet, 0, "play_skill_self", true)
end
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.BulletTime==0 and 4 or combat.BulletTime/1000)
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.BulletTime == 0 and 4 or
combat.BulletTime / 1000)
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
LogError("全屏特效屏幕中心"..tostring(combat.Id))
LogError("全屏特效屏幕中心" .. tostring(combat.Id))
local go2 = BattleManager.LoadAsset(combat.Bullet, sortingOrder)
go2.transform:SetParent(self.effectRoot.transform)
-- 检测特效旋转
-- if self:CheckRotate(go2, combat.Orientation) then
-- offset = -offset
-- end
go2.transform.localScale = Vector3.New(combat.HitScale[1]/1000,combat.HitScale[2]/1000,1)
go2.transform.localScale = Vector3.New(combat.HitScale[1] / 1000, combat.HitScale[2] / 1000, 1)
go2.transform.localPosition = Vector3.zero
go2.transform.anchoredPosition = offset
go2:SetActive(true)
local compnet=go2:GetComponent("SkeletonGraphic")
if compnet~=nil then
local compnet = go2:GetComponent("SkeletonGraphic")
if compnet ~= nil then
-- compnet.transform.localScale = Vector3.one * 3
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
LogError("comming"..combat.Bullet)
LogError("comming" .. combat.Bullet)
local _complete = nil
_complete = function(state)
compnet.AnimationState.Complete = compnet.AnimationState.Complete - _complete
@ -621,7 +628,7 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
compnet.AnimationState.Complete = compnet.AnimationState.Complete
--self.owner:PlaySpineAnim (compnet,0,"attack",false)
end
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, 30000/1000)
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, 30000 / 1000)
-- 会自己动的指定目标特效
@ -649,22 +656,19 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
local targetPos = go2.transform.localPosition
local startPos = targetPos + Vector3.New(400, 0, 0)
go2.transform.localPosition = startPos
go2.transform:DOLocalMove(targetPos, skillduration/1000, false)
local compnet=go2:GetComponent("SkeletonGraphic")
if compnet~=nil then
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,"play_skill_self",true)
self.owner:PlaySpineAnim(compnet, 0, "play_skill_self", true)
end
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, skillduration/1000)
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, skillduration / 1000)
end
end
-- 射线特效(丢子弹?)
elseif combat.EffectType == 7 then
local targets = skill:GetDirectTargets()
for _, target in ipairs(targets) do
local tv = self.owner.RootPanel.GetRoleView(target)
@ -686,25 +690,24 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
-- 特效旋转补正
local fixRotate = self:CalRoleRotate(self.owner, tv)
go2.transform.localEulerAngles = go2.transform.localEulerAngles+fixRotate
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 sl = dis / 1000
go2.transform.localScale = Vector3.New(1, sl, 1)
local compnet=go2:GetComponent("SkeletonGraphic")
if compnet~=nil then
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,"play_skill_self",true)
self.owner:PlaySpineAnim(compnet, 0, "play_skill_self", true)
end
--
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.BulletTime/1000 + 0.2) -- 额外增加0.2秒显示时间
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.BulletTime / 1000 + 0.2) -- 额外增加0.2秒显示时间
end
end
--近战特效
-- elseif combat.EffectType == 8 then
@ -788,7 +791,6 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
elseif combat.EffectType == 9 then
local path = combat.Bullet
if path then
local pos = self:GetEffectPosition(skill)
if not pos then
return
@ -802,46 +804,44 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
if self:CheckRotate(go, combat.Orientation) then
offset = -offset
end
if go ~=nil then
if go ~= nil then
go.transform:SetParent(self.effectRoot.transform)
go.transform.localScale = Vector3.New(combat.HitScale[1]/1000,combat.HitScale[2]/1000,1)
go.transform.localScale = Vector3.New(combat.HitScale[1] / 1000, combat.HitScale[2] / 1000, 1)
go.transform.localPosition = pos + offset
go:SetActive(true)
local compnet=go:GetComponent("SkeletonGraphic")
if compnet~=nil then
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,"play_skill_self",false)
self.owner:PlaySpineAnim(compnet, 0, "play_skill_self", false)
end
BattleManager.AddDelayRecycleRes(path, go, combat.BulletTime==0 and 4 or combat.BulletTime/1000)
BattleManager.AddDelayRecycleRes(path, go, combat.BulletTime == 0 and 4 or combat.BulletTime / 1000)
end
end
end
-- 取消高亮
self.owner:DelayFunc(combat.HightLightTime/1000, function()
self.owner:DelayFunc(combat.HightLightTime / 1000, function()
self:CheckSkillHitEffect("skill", combat, skill)
end)
-- 判断是否震屏
-- bulletTime +
if combat.ShockScreen == 1 then
self.owner:DelayFunc((combat.ShankTime + combat.DamageDelay)/1000, function()
self.owner:DelayFunc((combat.ShankTime + combat.DamageDelay) / 1000, function()
self:checkShake(combat)
end)
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(deltaY/deltaX))/math.pi*180
local deltaR = math.atan(math.abs(deltaY / deltaX)) / math.pi * 180
--camp==1是enmeycamp==0是player
if baseRole.camp == 0 and deltaY > 0 then
return Vector3.New(0, 0, deltaR)
@ -855,7 +855,6 @@ function SkillCaster:CalRoleRotate(baseRole, targetRole)
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)
@ -876,7 +875,8 @@ function SkillCaster:CheckSkillForoleEffect(combat, skill)
end
local go
local path = combat.BeforeBullet
local offset = combat.BeforeOffset and Vector3.New(combat.BeforeOffset[1], combat.BeforeOffset[2], 0) or Vector3.zero
local offset = combat.BeforeOffset and Vector3.New(combat.BeforeOffset[1], combat.BeforeOffset[2], 0) or Vector3
.zero
local pos = Vector3.zero
-- 挂在人身上,以人物中心为原点
@ -925,7 +925,7 @@ end
-- 检测技能命中特效显示
function SkillCaster:CheckSkillHitEffect(checkType, combat, skill)
if not combat or combat.Hit==nil or combat.Hit=="" then return end
if not combat or combat.Hit == nil or combat.Hit == "" then return end
if checkType == "skill" then
-- 释放技能时检测,如果是范围命中效果
if combat.HitEffectType == 2 and combat.Hit then
@ -940,7 +940,8 @@ function SkillCaster:CheckSkillHitEffect(checkType, combat, skill)
-- 特效的偏移量
local offset = combat.HitOffset and Vector3.New(combat.HitOffset[1], combat.HitOffset[2], 0) or Vector3.zero
local sortingOrder = tv.role.camp == 0 and tv.GameObject:GetComponent("Canvas").sortingOrder + 21 or BattleManager.GetBattleSorting() + 20
local sortingOrder = tv.role.camp == 0 and tv.GameObject:GetComponent("Canvas").sortingOrder + 21 or
BattleManager.GetBattleSorting() + 20
local go = BattleManager.LoadAsset(combat.Hit, sortingOrder)
go.transform:SetParent(self.effectRoot.transform)
-- 检测特效旋转
@ -951,46 +952,45 @@ function SkillCaster:CheckSkillHitEffect(checkType, combat, skill)
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
local scale = combat.HitScale and Vector3.New(combat.HitScale[1]/1000, combat.HitScale[2]/1000, 0) or Vector3.One
local sortingOrder = self.owner.role.camp == 0 and self.owner.GameObject:GetComponent("Canvas").sortingOrder + 21 or BattleManager.GetBattleSorting() + 20
local scale = combat.HitScale and Vector3.New(combat.HitScale[1] / 1000, combat.HitScale[2] / 1000, 0) or
Vector3.One
local sortingOrder = self.owner.role.camp == 0 and
self.owner.GameObject:GetComponent("Canvas").sortingOrder + 21 or BattleManager.GetBattleSorting() + 20
local go2 = BattleManager.LoadSpineAsset(combat.Hit, self.owner.SingleHitEffectRoot.transform)
if go2 then
-- 检测特效旋转
go2.transform:SetParent(self.owner.SingleHitEffectRoot.transform)
local compnet=go2:GetComponent("SkeletonGraphic")
if compnet~=nil then
local compnet = go2:GetComponent("SkeletonGraphic")
if compnet ~= nil then
-- compnet.transform.localScale = Vector3.one * 3
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
compnet.AnimationState:SetAnimation(0, "atk", true)
compnet.AnimationState.TimeScale=combat.HitTimeScale/1000
compnet.AnimationState.TimeScale = combat.HitTimeScale / 1000
end
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
go2.transform.localPosition = Vector3
.zero --self.GameObject.transform.localPosition + Vector3.New(0, self.BuffFloatingCount * 180, 0)
go2.transform.anchoredPosition = offset --Vector2.zero
-- go2.transform:SetParent(self.effectRoot.transform)
go2.transform.localScale = scale
go2:SetActive(true)
BattleManager.AddDelayRecycleRes(combat.Hit, go2,combat.HitRecycleTime/1000 )
BattleManager.AddDelayRecycleRes(combat.Hit, go2, combat.HitRecycleTime / 1000)
else
LogError("combat.hit=========="..combat.Hit.." is null")
LogError("combat.hit==========" .. combat.Hit .. " is null")
end
LogError("HitTime")
end
end
end
-- 检测是否需要震动屏幕
function SkillCaster:checkShake(combat)
-- self.owner.Floater:SetPosition(self.owner.GameObject.transform.position)
@ -1015,11 +1015,10 @@ local plist = {
-- 播放弹道特效
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 duration = combat.BulletTime / 1000
local bulletEffect = combat.Bullet
if not bulletEffect or bulletEffect == "" or duration == 0 then return end
@ -1042,19 +1041,19 @@ function SkillCaster:RoleViewBullet(combat, target)
local deltaX = targetPos.x - startPos.x
local deltaY = targetPos.y - startPos.y
local deltaR = math.atan(math.abs(deltaX/deltaY))/math.pi*180
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
local compnet=go:GetComponent("SkeletonGraphic")
if compnet~=nil then
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,"play_skill_self",true)
self.owner:PlaySpineAnim(compnet, 0, "play_skill_self", true)
end
-- go.transform.localPosition = startPos
go.transform:DOMove(targetPos, combat.BulletTime/1000, false):OnComplete(function ()
go.transform:DOMove(targetPos, combat.BulletTime / 1000, false):OnComplete(function()
poolManager:UnLoadAsset(bulletEffect, go, PoolManager.AssetType.GameObject)
end)
@ -1086,5 +1085,4 @@ function SkillCaster:RoleViewBullet(combat, target)
-- end)
end
return SkillCaster