Beispiel #1
0
    // Unity lifecycle method
    void Start()
    {
        // reset the PlayerTurnController, this is only helpful when a game gets reset or restarted
        PlayerTurnController.init();
        PlayerScoreController.startNewGame();

        masterGameTimeText                 = GameObject.FindGameObjectWithTag("masterGameTime").gameObject;
        elapsedTurnTimeText                = GameObject.FindGameObjectWithTag("elapsedTurnTime").gameObject;
        winnerBannerText                   = GameObject.FindGameObjectWithTag("winnerBanner").gameObject;
        playerTurnView                     = GameObject.FindGameObjectWithTag("playerTurnView").gameObject;
        undoLastMoveButtonController       = GameObject.FindGameObjectWithTag("undoLastMoveButtonController").gameObject;
        undoLastMoveButtonControllerScript = undoLastMoveButtonController.GetComponent <UndoLastMoveButtonController>();
        playerOneScoreView                 = GameObject.FindGameObjectWithTag("playerOneScoreView").gameObject;
        playerTwoScoreView                 = GameObject.FindGameObjectWithTag("playerTwoScoreView").gameObject;

        // FIXME: move this to a view class
        playerOneScoreView.GetComponent <Text>().text = "0";
        playerTwoScoreView.GetComponent <Text>().text = "0";
        winnerBannerText.GetComponent <Text>().text   = "";
        currentGameTime = 0f;
        didStart        = true;

        resetTurnTime();
    }
    // Unity lifecycle method
    void Start()
    {
        // reset the PlayerTurnController, this is only helpful when a game gets reset or restarted
        PlayerTurnController.init();
        PlayerScoreController.startNewGame();

        masterGameTimeText = GameObject.FindGameObjectWithTag("masterGameTime").gameObject;
        elapsedTurnTimeText = GameObject.FindGameObjectWithTag("elapsedTurnTime").gameObject;
        winnerBannerText = GameObject.FindGameObjectWithTag("winnerBanner").gameObject;
        playerTurnView = GameObject.FindGameObjectWithTag("playerTurnView").gameObject;
        undoLastMoveButtonController = GameObject.FindGameObjectWithTag("undoLastMoveButtonController").gameObject;
        undoLastMoveButtonControllerScript = undoLastMoveButtonController.GetComponent<UndoLastMoveButtonController>();
        playerOneScoreView = GameObject.FindGameObjectWithTag("playerOneScoreView").gameObject;
        playerTwoScoreView = GameObject.FindGameObjectWithTag("playerTwoScoreView").gameObject;

        // FIXME: move this to a view class
        playerOneScoreView.GetComponent<Text>().text = "0";
        playerTwoScoreView.GetComponent<Text>().text = "0";
        winnerBannerText.GetComponent<Text>().text = "";
        currentGameTime = 0f;
        didStart = true;

        resetTurnTime();
    }