Example #1
0
    // Game State changed.
    void OnGameStateChanged()
    {
        switch (gameState)
        {
        case (int)GameState.Start:
            if (curController != null)
            {
                curController.enabled = false;
            }
            curController = GetComponent <StartController>();
            curController.newlyEnabled = true;
            curController.enabled      = true;
            break;

        case (int)GameState.ModeSetting:
            curController.enabled      = false;
            curController              = GetComponent <ModeSettingController>();
            curController.newlyEnabled = true;
            curController.enabled      = true;
            break;

        case (int)GameState.KinectUserDitect:
            curController.enabled      = false;
            curController              = GetComponent <KinectDetectController>();
            curController.newlyEnabled = true;
            curController.enabled      = true;
            break;

        case (int)GameState.Run:
            if (curController != null)
            {
                curController.enabled = false;
            }
            if (backController != null)
            {
                curController         = backController;
                backController        = null;
                curController.enabled = true;
            }
            else
            {
                curController = GetComponent <RunController>();
                curController.newlyEnabled = true;
                curController.enabled      = true;
            }
            break;

        case (int)GameState.Stop:
            curController.AfterStop();
            curController.enabled      = false;
            curController              = GetComponent <StopController>();
            curController.newlyEnabled = true;
            curController.enabled      = true;
            break;
        }
    }