local Base = require("Battle/Logic/Level/LevelItemFactory/LevelItem") local LevelItem_PointCamera = class("LevelItem_PointCamera", Base) local EventSystem = require('Event/EventSystem') --region --***************生命周期***************-- function LevelItem_PointCamera:initialize(data) Base.initialize(self,data) self._callback_CameraReach = function() self:UpdateCameraPoint() end end function LevelItem_PointCamera:OnActive() if Base.OnActive(self) then self.PointIndex = 0 --开始接口 CameraController.Instance:SetPointSystem(true, 0, self._callback_CameraReach) EventSystem.Dispatch(EventID.HomeMain_TimeLineActive, false, true) self:UpdateCameraPoint() return true end end function LevelItem_PointCamera:OnDeactive() if Base.OnDeactive(self) then self.PointIndex = nil CameraController.Instance:SetPointSystem(false, self.ItemData.BlendTime) EventSystem.Dispatch(EventID.HomeMain_TimeLineActive, true, true) return true end end --endregion 生命周期 --region --***************事件相关***************-- function LevelItem_PointCamera:DoAction(actionType) Base.DoAction(self, actionType) if actionType == LuaConst.LevelActionType.PointCamera_Active then self:OnActive() elseif actionType == LuaConst.LevelActionType.PointCamera_Deactive then self:OnDeactive() end end --endregion 事件相关 function LevelItem_PointCamera:UpdateCameraPoint() self.PointIndex = self.PointIndex + 1 if self.PointIndex > #self.ItemData.CameraPointList then self:Dispatch(LuaConst.LevelConditionType.PointCamera_Complete,nil, self.LevelItemID) self:DoAction(LuaConst.LevelActionType.PointCamera_Deactive) return end local point = self.ItemData.CameraPointList[self.PointIndex] local pos = point.Position local rot = point.Rotation CameraController.Instance:BeginPointCamera(point.BlendTime,point.StayTime,pos.x,pos.y,pos.z,rot.x,rot.y,rot.z,rot.w) end return LevelItem_PointCamera