Exemple #1
0
    // Maintains all necessary variables for transitioning into the next scene (the scene with the greater scene number). PlayTransition() will handle the actual animation
    public float VisitNextScene()
    {
        Debug.Log("Before increment: " + currentSceneNumber);
        if (currentSceneNumber < sceneDataArray.Length)
        {
            currentSceneNumber      += 1;
            isDuringTransition       = true;
            currentTransitionType    = TransitionType.Forward;
            currentAnimationClipName = sceneDataArray[currentSceneNumber - 1].forwardAnimationClipName;
            Debug.Log(sceneDataArray[currentSceneNumber - 1].name);
            currentAnimationClipLength = sceneDataArray[currentSceneNumber - 1].forwardAnimationClipLength;

            if (sceneDataArray[currentSceneNumber - 1] is ExteriorSceneData)
            {
                if (sceneDataArray[currentSceneNumber - 2] is SceneData)
                {
                    animator = cameraAnimator;
                    ExteriorSceneData currentExteriorSceneData = (ExteriorSceneData)sceneDataArray[currentSceneNumber - 1];
                    SetRenderTexture?.Invoke(currentExteriorSceneData.renderTexture);
                }
            }
            else
            {
                if (sceneDataArray[currentSceneNumber - 2] is ExteriorSceneData)
                {
                    animator = oldAnimator;
                    DisableRenderTexture?.Invoke();
                }
            }


            //if (sceneDataArray[currentSceneNumber - 1] is ExteriorSceneData)
            //{
            //    // sceneDataArray[currentSceneNumber - 1].AssignAnimatorAndRuntimeController(this);
            //    animator = cameraAnimator;
            //    ExteriorSceneData currentExteriorSceneData = (ExteriorSceneData)sceneDataArray[currentSceneNumber - 1];
            //    SetRenderTexture?.Invoke(currentExteriorSceneData.renderTexture);
            //} else
            //{
            //    animator = oldAnimator;
            //}

            VisitNextEvent?.Invoke(sceneDataArray[currentSceneNumber - 1]);
            PlayTransition();
            if (ar != null)
            {
                ar.QueueMessage("VisitNextScene");
            }

            return(currentAnimationClipLength);
        }
        return(0f);
    }
Exemple #2
0
    //public void SetCurrentAnimationClipLength(float clipLength)
    //{
    //    currentAnimationClipLength = clipLength;
    //}

    // Adjusts all necessary variables for transitioning into the previous scene (the scene with the smaller scene number). TransitionToAnotherScene() will handle the actual animation
    public void VisitPreviousScene()
    {
        Debug.Log("Before decrement: " + currentSceneNumber);
        if (currentSceneNumber > 1)
        {
            currentSceneNumber        -= 1;
            isDuringTransition         = true;
            currentTransitionType      = TransitionType.Backward;
            currentAnimationClipName   = sceneDataArray[currentSceneNumber - 1].backwardAnimationClipName;
            currentAnimationClipLength = sceneDataArray[currentSceneNumber - 1].backwardAnimationClipLength;


            if (sceneDataArray[currentSceneNumber - 1] is ExteriorSceneData)
            {
                if (!(sceneDataArray[currentSceneNumber] is ExteriorSceneData))
                {
                    animator = cameraAnimator;
                    ExteriorSceneData currentExteriorSceneData = (ExteriorSceneData)sceneDataArray[currentSceneNumber - 1];
                    SetRenderTexture?.Invoke(currentExteriorSceneData.renderTexture);
                }
            }
            else
            {
                if (sceneDataArray[currentSceneNumber] is ExteriorSceneData)
                {
                    // sceneDataArray[currentSceneNumber - 1].AssignAnimatorAndRuntimeController(this);
                    animator = oldAnimator;
                    DisableRenderTexture?.Invoke();
                }
            }



            VisitPreviousEvent?.Invoke(sceneDataArray[currentSceneNumber - 1]);

            PlayTransition();

            if (ar != null)
            {
                ar.QueueMessage("VisitPreviousScene");
            }
        }
    }