public override void exit() { base.exit(); cameraCtrl.transform.DOKill(); cameraCtrl.cam.DOKill(); cameraCtrl.replayGK = null; lookAtAction = null; focusShooter = false; }
void playAction(CameraActionBase action) { if (action == null) { Debug.LogError("action is null"); return; } switch (action.type) { case CameraActionType.LookAt: lookAtAction = action as LookAtAction; //Debug.LogError("lookAtAction type " + lookAtAction.lookAtType); break; case CameraActionType.FOV: { var fovAction = action as FOVAction; var time = fovAction.time.Value; var tweener = cameraCtrl.cam.DOFieldOfView(fovAction.target, time); if (fovAction.beginTime.HasValue) { tweener.SetDelay(fovAction.beginTime.Value); } if (fovAction.stayTime.HasValue) { var stayTime = fovAction.stayTime.Value; tweener.OnStart(() => { cameraCtrl.cam.DOFieldOfView(cameraCtrl.config.defaultFOV, time).SetDelay(stayTime); }); } } break; case CameraActionType.Move: { var moveAction = action as MoveAction; var tweener = cameraCtrl.transform.DOMove(moveAction.getTarget(inversePosition), moveAction.time.Value).SetEase(Ease.InOutCubic); if (moveAction.beginTime.HasValue) { tweener.SetDelay(moveAction.beginTime.Value); } } break; } }
CameraActionBase parseCameraAction(SecurityElement se) { if (se == null) { Debuger.LogError("se is null"); return(null); } CameraActionBase action = null; var type = (CameraActionType)se.parseInt("value"); switch (type) { case CameraActionType.LookAt: var lookAtAction = new LookAtAction(); lookAtAction.lookAtType = (LookAtType)se.parseInt("type"); action = lookAtAction; break; case CameraActionType.FOV: var fovAction = new FOVAction(); fovAction.target = se.parseFloat("target"); fovAction.beginTime = se.tryParseFloat("begintime"); fovAction.stayTime = se.tryParseFloat("staytime"); action = fovAction; break; case CameraActionType.Move: var moveAction = new MoveAction(); moveAction.beginTime = se.tryParseFloat("begintime"); moveAction.target = se.parseVector3(); action = moveAction; break; default: return(null); } action.type = type; action.time = se.tryParseFloat("time"); action.weight = se.tryParseInt("weight"); return(action); }