【战斗】弹道特效不在根据贝塞尔曲线运动
parent
0ea258d1e8
commit
bb15f0056e
|
@ -557,8 +557,8 @@ local plist = {
|
||||||
Vector2.New(0.2, 0.9),
|
Vector2.New(0.2, 0.9),
|
||||||
},
|
},
|
||||||
[2] = {
|
[2] = {
|
||||||
Vector2.New(1.12, 0.33),
|
Vector2.New(1, 0.33),
|
||||||
Vector2.New(-0.15, 0.67),
|
Vector2.New(0, 0.67),
|
||||||
},
|
},
|
||||||
[3] = {
|
[3] = {
|
||||||
Vector2.New(0.9, 0.2),
|
Vector2.New(0.9, 0.2),
|
||||||
|
@ -583,25 +583,54 @@ function SkillCaster:RoleViewBullet(combat, target)
|
||||||
Util.ClearTrailRender(go)
|
Util.ClearTrailRender(go)
|
||||||
go:SetActive(true)
|
go:SetActive(true)
|
||||||
|
|
||||||
local startV3 = go.transform.position
|
-- local startV3 = go.transform.position
|
||||||
local endV3 = self.owner.RootPanel.GetRoleView(target).GameObject.transform.position
|
-- local endV3 = self.owner.RootPanel.GetRoleView(target).GameObject.transform.position
|
||||||
|
|
||||||
local startV2 = Vector2.New(0, 0)
|
-- 特效旋转补正
|
||||||
local endV2 = Vector2.New(1, 1)
|
local tv = self.owner.RootPanel.GetRoleView(target)
|
||||||
|
|
||||||
|
local startPos = go.transform.position
|
||||||
|
local targetPos = tv.GameObject.transform.position
|
||||||
|
|
||||||
local pL = plist[math.random(1, #plist)]
|
local deltaX = targetPos.x - startPos.x
|
||||||
--飞行子弹轨迹
|
local deltaY = targetPos.y - startPos.y
|
||||||
DoTween.To(
|
local deltaR = math.atan(math.abs(deltaX/deltaY))/math.pi*180
|
||||||
DG.Tweening.Core.DOGetter_float( function () return 0 end),
|
|
||||||
DG.Tweening.Core.DOSetter_float(function (progress)
|
local fixRotate = self:CalRoleRotate(self.owner, tv)
|
||||||
local v2 = Bezier.CalPos(progress, startV2, endV2, pL)
|
go.transform.localEulerAngles = go.transform.localEulerAngles + fixRotate
|
||||||
go.transform.position = Vector3.New(startV3.x * (1-v2.x) + endV3.x * v2.x,
|
|
||||||
startV3.y * (1-v2.y) + endV3.y * v2.y, startV3.z)
|
|
||||||
end), 1, duration)
|
-- go.transform.localPosition = startPos
|
||||||
:SetEase(Ease.InQuad)
|
go.transform:DOMove(targetPos, combat.KeyFrame/1000, false):OnComplete(function ()
|
||||||
:OnComplete(function ()
|
|
||||||
poolManager:UnLoadAsset(bulletEffect, go, PoolManager.AssetType.GameObject)
|
poolManager:UnLoadAsset(bulletEffect, go, PoolManager.AssetType.GameObject)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
-- 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)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue