Пример #1
0
        override public float Run()
        {
            if (!isRunning)
            {
                isRunning = true;

                MainCamera mainCam = KickStarter.mainCamera;

                if (mainCam)
                {
                    _Camera cam = linkedCamera;

                    if (returnToLast && mainCam.lastNavCamera)
                    {
                        if (mainCam.lastNavCamera != null && mainCam.attachedCamera == mainCam.lastNavCamera)
                        {
                            cam = (_Camera)mainCam.lastNavCamera2;
                        }
                        else
                        {
                            cam = (_Camera)mainCam.lastNavCamera;
                        }
                    }

                    if (cam)
                    {
                        if (mainCam.attachedCamera != cam)
                        {
                            if (cam is GameCameraThirdPerson)
                            {
                                GameCameraThirdPerson tpCam = (GameCameraThirdPerson)cam;
                                tpCam.ResetRotation();
                            }
                            else if (cam is GameCameraAnimated)
                            {
                                GameCameraAnimated animCam = (GameCameraAnimated)cam;
                                animCam.PlayClip();
                            }

                            mainCam.SetGameCamera(cam);
                            if (transitionTime > 0f)
                            {
                                if (linkedCamera is GameCamera25D)
                                {
                                    mainCam.SnapToAttached();
                                    Debug.LogWarning("Switching to a 2.5D camera (" + linkedCamera.name + ") must be instantaneous.");
                                }
                                else
                                {
                                    mainCam.SmoothChange(transitionTime, moveMethod, timeCurve);

                                    if (willWait)
                                    {
                                        return(transitionTime);
                                    }
                                }
                            }
                            else
                            {
                                cam.MoveCameraInstant();
                                mainCam.SnapToAttached();

                                if (linkedCamera is GameCameraAnimated && willWait)
                                {
                                    return(defaultPauseTime);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                if (linkedCamera is GameCameraAnimated && willWait)
                {
                    GameCameraAnimated animatedCamera = (GameCameraAnimated)linkedCamera;
                    if (animatedCamera.isPlaying())
                    {
                        return(defaultPauseTime);
                    }
                    else
                    {
                        isRunning = false;
                        return(0f);
                    }
                }
                else
                {
                    isRunning = false;
                    return(0f);
                }
            }

            return(0f);
        }