修改skillcast

onepiece_demo_arena
xiejun 2023-12-14 17:34:20 +08:00
parent 8c0dd3a9b0
commit 705b651886
1 changed files with 99 additions and 55 deletions

View File

@ -82,26 +82,54 @@ function SkillCaster:OnSkillCast(skill)
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)
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]
end
end
local targets = skill:GetDirectTargets()
LogError( tostring(self:GetMovePosition(skill)))
if #targets >0 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]
end
end
LogError(tostring(postion))
LogError(tostring(Vector3.New(postion.x-(self.owner.camp==0 and posx or(-posx)),postion.y+posy,postion.z)))
self.owner.RoleLiveGO.transform:DOLocalMove(Vector3.New(postion.x-(self.owner.camp==0 and posx or(-posx)),postion.y+posy,postion.z), combat.AttackDisplaceTime/1000, false):OnComplete(function ()
if self.owner.OnSkillPlay then
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]
end
if displaceoffset[2] and type(displaceoffset[2]) ~="userdata" then
posy=displaceoffset[2]
end
end
--LogError("技能位移Id"..combat.Id.."开始时间"..os.date())
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 ()
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype,combat)
--LogError("技能位移Id"..combat.Id.."结束时间"..os.date())
end
end)
end
end
self.owner.RoleLiveGO.transform:DOMove(Vector3.New(t.GameObject.transform.position.x-(self.owner.camp==0 and posx or(-posx)),t.GameObject.transform.position.y+posy,t.GameObject.transform.position.z), combat.AttackDisplaceTime/1000, false):OnComplete(function ()
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype,combat)
end
end)
end
else
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype,combat)
@ -109,36 +137,36 @@ function SkillCaster:OnSkillCast(skill)
end
-- 播放
-- 这里相当于技能前摇,等待立绘播放到需要释放关键帧的时间时继续释放技能(人物前摇特效)
if 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 then
if skill.AttackDisplaceOffset and #skill.AttackDisplaceOffset>0 and type(skill.AttackDisplaceOffset[1]) ~="userdata" and type(skill.AttackDisplaceOffset[2]) ~="userdata" then
displaceoffset=skill.AttackDisplaceOffset
end
end
self.owner.GameObject:SetActive(false)
local targets = skill:GetDirectTargets()
for _, target in ipairs(targets) do
-- if 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 then
-- if skill.AttackDisplaceOffset and #skill.AttackDisplaceOffset>0 and type(skill.AttackDisplaceOffset[1]) ~="userdata" and type(skill.AttackDisplaceOffset[2]) ~="userdata" then
-- displaceoffset=skill.AttackDisplaceOffset
-- end
-- end
-- self.owner.GameObject:SetActive(false)
-- local targets = skill:GetDirectTargets()
-- for _, target in ipairs(targets) do
local t= self.owner.RootPanel.GetRoleView(target)
--LogError("技能位移Id"..combat.Id.."开始时间"..os.date())
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 ()
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype,combat)
--LogError("技能位移Id"..combat.Id.."结束时间"..os.date())
end
end)
end
else
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype,combat)
end
end
-- local t= self.owner.RootPanel.GetRoleView(target)
-- --LogError("技能位移Id"..combat.Id.."开始时间"..os.date())
-- 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 ()
-- if self.owner.OnSkillPlay then
-- self.owner:OnSkillPlay(localtype,combat)
-- --LogError("技能位移Id"..combat.Id.."结束时间"..os.date())
-- end
-- end)
-- end
-- else
-- if self.owner.OnSkillPlay then
-- self.owner:OnSkillPlay(localtype,combat)
-- end
-- end
if self.owner.role.type == BattleUnitType.Role then
if combat.BeforeEffectDelay then
self.owner:DelayFunc(combat.BeforeEffectDelay/1000, function()
@ -314,11 +342,27 @@ 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(-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(990,-551 , 0), --后面一列
Enemy_COL_1 = Vector3.New(990, 916, 0),--第一行
Enemy_COL_2 = Vector3.New(990, 378, 0),--第二行
Enemy_COL_3 = Vector3.New(990, -250, 0),--第三行
}
function SkillCaster:GetEffectSPostion(skill)
local chooseId = skill:GetDirectChooseId()
local chooseLimit = math.floor(chooseId / 10000) % 10
@ -334,7 +378,7 @@ function SkillCaster:GetEffectSPostion(skill)
end
return FullEffectPosition.My_All
end
function SkillCaster:GetEffectPosition(skill)
function SkillCaster:GetMovePosition(skill)
local chooseId = skill:GetDirectChooseId()
local chooseLimit = math.floor(chooseId / 10000) % 10
local targets = skill:GetDirectTargets()
@ -344,18 +388,18 @@ function SkillCaster:GetEffectPosition(skill)
if chooseLimit == 0 or chooseLimit == 4 or chooseLimit == 5 then
return targetCamp == 0 and FullEffectPosition.My_All or FullEffectPosition.Enemy_All
return targetCamp == 0 and MoveMentPosition.My_All or MoveMentPosition.Enemy_All
elseif chooseLimit == 1 or chooseLimit == 2 then --前排,后排
if targetCamp == 0 then
return targetPos <= 3 and FullEffectPosition.My_Front or FullEffectPosition.My_Behind
return targetPos <= 3 and MoveMentPosition.My_Front or MoveMentPosition.My_Behind
else
return targetPos <= 3 and FullEffectPosition.Enemy_Front or FullEffectPosition.Enemy_Behind
return targetPos <= 3 and MoveMentPosition.Enemy_Front or MoveMentPosition.Enemy_Behind
end
elseif chooseLimit == 3 then --队列
local col = (targetPos-1) % 3 + 1
return targetCamp == 0 and FullEffectPosition["My_COL_"..col] or FullEffectPosition["Enemy_COL_"..col]
return targetCamp == 0 and MoveMentPosition["My_COL_"..col] or MoveMentPosition["Enemy_COL_"..col]
end
return FullEffectPosition.My_All
return MoveMentPosition.My_All
end
-- 检测特效旋转