local base = require("Scene.LWBattle.Bullet.BulletTrackingBase")
local BulletCurveTracking = BaseClass("BulletCurveTracking", base)
local BulletViewFacade = CS.PVEBattleLogic.Bullet.BulletViewFacade

function BulletCurveTracking:OnShow()
  base.OnShow(self)
  if self.logicDie then
    return
  end
  if self.height > 0 then
    local doubleHeight = self.height * 2
    self.distance = self.distance + doubleHeight
    self.ctrlPoint2.y = self.startPos.y + doubleHeight
  else
    local doubleHeight = self.distance * self.heightWidthRatio * 2
    self.distance = self.distance + doubleHeight
    self.ctrlPoint2.y = self.startPos.y + doubleHeight
  end
  if self.noCollision then
    self.duration = self:GetForceLifeTime()
  else
    self.duration = self.distance / self.flySpeed
  end
  local forward = self.ctrlPoint2 - self.ctrlPoint1
  BulletViewFacade.SetForward(self.viewHandle, forward.x, forward.y, forward.z)
end

return BulletCurveTracking
