【战斗】弹道特效不在根据贝塞尔曲线运动
parent
0ea258d1e8
commit
bb15f0056e
|
@ -557,8 +557,8 @@ local plist = {
|
|||
Vector2.New(0.2, 0.9),
|
||||
},
|
||||
[2] = {
|
||||
Vector2.New(1.12, 0.33),
|
||||
Vector2.New(-0.15, 0.67),
|
||||
Vector2.New(1, 0.33),
|
||||
Vector2.New(0, 0.67),
|
||||
},
|
||||
[3] = {
|
||||
Vector2.New(0.9, 0.2),
|
||||
|
@ -583,25 +583,54 @@ function SkillCaster:RoleViewBullet(combat, target)
|
|||
Util.ClearTrailRender(go)
|
||||
go:SetActive(true)
|
||||
|
||||
local startV3 = go.transform.position
|
||||
local endV3 = self.owner.RootPanel.GetRoleView(target).GameObject.transform.position
|
||||
-- local startV3 = go.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)]
|
||||
--飞行子弹轨迹
|
||||
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)
|
||||
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)
|
||||
:SetEase(Ease.InQuad)
|
||||
:OnComplete(function ()
|
||||
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
|
||||
|
||||
|
||||
-- go.transform.localPosition = startPos
|
||||
go.transform:DOMove(targetPos, combat.KeyFrame/1000, false):OnComplete(function ()
|
||||
poolManager:UnLoadAsset(bulletEffect, go, PoolManager.AssetType.GameObject)
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue