//场景动画播放完毕调用
    void changjingAniFin()
    {
        //隐藏建模体
        STEventHandler.Hide();
        //先对周围塔楼进行渲染
        STEventHandler.ShowPropClones();
        //停止地形更新
        ReconstructionBehaviour.Reconstruction.Stop();
        //进入游戏动画阶段
        currentState = GameState.ANIMATION;

        //若无周围边塔,直接对主塔进行渲染
        if (STEventHandler.num == 0)
        {
            //播放中心塔楼动画
            towerAnim.Play();
        }
    }
Exemple #2
0
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Escape) || Input.GetKeyUp(KeyCode.JoystickButton0))
        {
            #if UNITY_EDITOR
            UnityEditor.EditorApplication.isPlaying = false;
            #else
            Application.Quit();
            #endif
        }

        bool showOutline     = false;
        bool showDoneButton  = false;
        bool showResetButton = false;

        switch (mState)
        {
        //Detection phase
        case UIStates.OVERLAY_OUTLINE:
            instructionsImage.texture = mPointDeviceTexture;
            mSmartSurface.GetComponent <Renderer>().enabled = false;
            showOutline = true;
            break;

        // Soda can ice animating phase
        case UIStates.INIT_ANIMATION:
            mSmartSurface.GetComponent <Renderer>().enabled = false;
            Ice anim = GameObject.FindObjectOfType <Ice>();
            anim.Play();
            if (anim.DidFinishAnimation)
            {
                mSmartSurface.GetComponent <Renderer>().enabled = mSTTrackableHandler.m_trackablesFound;
                mState = UIStates.SCANNING;
            }
            break;

        // Scanning phase
        case UIStates.SCANNING:
            mSmartSurface.GetComponent <Renderer>().enabled = mSTTrackableHandler.m_trackablesFound;
            instructionsImage.texture = mPullBackTexture;
            showDoneButton            = true;
            break;

        // Icebergs rendering phase - user taps on [DONE] button
        case UIStates.GAME_RENDERING:
            if ((mReconstructionBehaviour != null) && (mReconstructionBehaviour.Reconstruction != null))
            {
                mSTEventHandler.ShowPropClones();
                mReconstructionBehaviour.Reconstruction.Stop();
                mState = UIStates.GAME_PLAY;
            }
            break;

        //Penguin appears and user taps on surface to move the penguin around
        case UIStates.GAME_PLAY:
            if (mSTEventHandler.propsCloned && !penguin.DidAppear)
            {
                penguin.gameObject.SetActive(true);
            }

            if (penguin.DidAppear)
            {
                // Update UI messaging
                instructionsImage.texture = mTapIceTexture;
                showResetButton           = true;
            }
            break;

        //User taps on [RESET] button - Re-loads the level
        case UIStates.RESET_ALL:
            // Go back to loading scene
            int loadingScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex - 1;
            if (loadingScene < 0)
            {
                loadingScene = 0;
            }
            UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(loadingScene);

            mState = UIStates.NONE;
            break;

        // Just a placeholder state, to make sure that the previous state runs for just one frame.
        case UIStates.NONE: break;
        }

        if (cylinderOutline != null &&
            showOutline != cylinderOutline.enabled)
        {
            cylinderOutline.enabled = showOutline;
        }

        if (doneButton != null &&
            showDoneButton != doneButton.enabled)
        {
            doneButton.enabled       = showDoneButton;
            doneButton.image.enabled = showDoneButton;
            doneButton.gameObject.SetActive(showDoneButton);
        }

        if (resetButton != null &&
            showResetButton != resetButton.enabled)
        {
            resetButton.enabled       = showResetButton;
            resetButton.image.enabled = showResetButton;
            resetButton.gameObject.SetActive(showResetButton);
        }
    }