Exemple #1
0
        private CameraControllerTransition getTransition(CameraController fromController, CameraController toController)
        {
            CameraControllerTransition cameraControllerTransition = fromController.GetTransitionToOtherController(toController);

            if (cameraControllerTransition == null)
            {
                cameraControllerTransition = toController.DefaultControllerTransitionIn;
                CameraControllerTransition defaultControllerTransitionOut = fromController.DefaultControllerTransitionOut;
                if (cameraControllerTransition == null)
                {
                    cameraControllerTransition = defaultControllerTransitionOut;
                }
                else if (defaultControllerTransitionOut != null && defaultControllerTransitionOut.DefaultTransitionOutPriority > cameraControllerTransition.DefaultTransitionInPriority)
                {
                    cameraControllerTransition = defaultControllerTransitionOut;
                }
            }
            return(cameraControllerTransition);
        }
Exemple #2
0
        private bool updateActiveCameraControllers()
        {
            bool             result           = false;
            CameraController cameraController = getCurrentGoalPlannerController();

            if (currentGoalPlannerController == null)
            {
                currentGoalPlannerController = cameraController;
                currentGoalPlannerController.Activate();
                result = true;
            }
            else if (cameraController != currentGoalPlannerController)
            {
                CameraControllerTransition transition = getTransition(currentGoalPlannerController, cameraController);
                snapMove |= forceCutTransition;
                currentGoalPlannerController.Deactivate();
                currentGoalPlannerController = cameraController;
                currentGoalPlannerController.Activate();
                moveBlendState.Abort();
                if (transition == null || snapMove)
                {
                    maxMoveSpeed = -1f;
                }
                else if (transition.TransitionType == CameraControllerTransition.CameraTransitionType.CUT)
                {
                    maxMoveSpeed = -1f;
                    _            = snapMove;
                    snapMove     = true;
                }
                else if (transition.TransitionType == CameraControllerTransition.CameraTransitionType.MAX_SPEED)
                {
                    if (transition.LimitMoveSpeed)
                    {
                        maxMoveSpeed = transition.MaxMoveSpeed;
                    }
                }
                else if (transition.TransitionType == CameraControllerTransition.CameraTransitionType.CURVE)
                {
                    if (transition.Duration <= 0f)
                    {
                        maxMoveSpeed = -1f;
                        _            = snapMove;
                        snapMove     = true;
                    }
                    else
                    {
                        moveBlendState.FirstFramePos      = base.transform.position;
                        moveBlendState.Curve              = transition.Curve;
                        moveBlendState.Duration           = transition.Duration;
                        moveBlendState.ElapsedTime        = 0f;
                        moveBlendState.IsBlending         = true;
                        moveBlendState.DampenMovingTarget = transition.DampenMovingTarget;
                        moveBlendState.MaxSpeed           = (moveBlendState.DampenMovingTarget ? transition.MaxMoveSpeed : (-1f));
                        maxMoveSpeed = ((moveBlendState.DampenMovingTarget && transition.MaxMoveSpeed > -1f) ? 0f : (-1f));
                    }
                }
                result = true;
            }
            CameraController cameraController2 = getCurrentFramerController();

            if (currentFramerController == null)
            {
                currentFramerController = cameraController2;
                currentFramerController.Activate();
                result = true;
            }
            else if (cameraController2 != currentFramerController)
            {
                CameraControllerTransition transition = getTransition(currentFramerController, cameraController2);
                currentFramerController.Deactivate();
                currentFramerController = cameraController2;
                currentFramerController.Activate();
                aimBlendState.Abort();
                if (transition == null || snapAim)
                {
                    maxAimSpeed = -1f;
                }
                else if (transition.TransitionType == CameraControllerTransition.CameraTransitionType.CUT)
                {
                    maxAimSpeed = -1f;
                    _           = snapAim;
                    snapAim     = true;
                }
                else if (transition.TransitionType == CameraControllerTransition.CameraTransitionType.MAX_SPEED)
                {
                    if (transition.LimitAimSpeed)
                    {
                        maxAimSpeed = transition.MaxAimSpeed;
                    }
                }
                else if (transition.TransitionType == CameraControllerTransition.CameraTransitionType.CURVE)
                {
                    if (transition.Duration <= 0f)
                    {
                        maxAimSpeed = -1f;
                        _           = snapAim;
                        snapAim     = true;
                    }
                    else
                    {
                        aimBlendState.FirstFrameRot               = base.transform.rotation;
                        aimBlendState.SmoothedAim                 = base.transform.rotation;
                        aimBlendState.Curve                       = transition.Curve;
                        aimBlendState.Duration                    = transition.Duration;
                        aimBlendState.ElapsedTime                 = 0f;
                        aimBlendState.IsBlending                  = true;
                        aimBlendState.DampenMovingTarget          = transition.DampenMovingTarget;
                        aimBlendState.MaxSpeed                    = (aimBlendState.DampenMovingTarget ? transition.MaxAimSpeed : (-1f));
                        aimBlendState.DoubleDampenMovingTargetAim = transition.DoubleDampenMovingTargetAim;
                        maxAimSpeed = aimBlendState.MaxSpeed;
                    }
                }
                result = true;
            }
            return(result);
        }