Example #1
0
    public void Update()
    {
        if (PD.isTransitioning)
        {
            return;
        }
        if (ExitDemoIfNeeded())
        {
            return;
        }
        UpdateMouseInput();
        EasterEggsArentSoEasteryWhenTheCodeIsOpenSourceIsItYouFuckdummy();
        if (HandleCountdown())
        {
            return;
        }
        bool clickedPause = HandlePauseButton();

        if (tutorialAssist != null)
        {
            tutorialAssist.DoUpdate(cursor1, cursor2);
        }
        if (PD.gameType == PersistData.GT.Campaign)
        {
            bool wasInCampaignShop = campaign.inCampaignShop;
            campaign.Update(PD.usingMouse && clicker.isDown(), clickedPause);
            bool returnHere = false;
            if (campaign.inCampaignShop || wasInCampaignShop != campaign.inCampaignShop)
            {
                if (usingTouchControls)
                {
                    ImUsingTouchControls();
                }
                UpdateTweens();
                returnHere = true;
            }
            if (campaign.inCampaignShop && !wasInCampaignShop)
            {
                pauseText.GetComponent <TextMesh>().text = GetXmlValue(GetXMLHead(), "confirm");
            }
            else if (wasInCampaignShop && !campaign.inCampaignShop)
            {
                pauseText.GetComponent <TextMesh>().text = GetXmlValue(GetXMLHead(), "pause");
            }
            if (returnHere)
            {
                return;
            }
            if (campaign.playerDied)
            {
                HandleVictory();
            }
        }
        else
        {
            if (board1.IsDead() || board2.IsDead())
            {
                HandleVictory();
            }
        }
        UpdateTweens();
        if (HandleGameOver())
        {
            return;
        }
        if (!HandlePause())
        {
            UpdateCursors();
            UpdateBoards();
            UpdateMirrors();
        }
        if (PD.gameType == PersistData.GT.Campaign)
        {
            hud.DoUpdate(paused, board1.GetScore(), (board2 as BoardWarCampaign).gold);
        }
        else if (PD.gameType == PersistData.GT.Challenge)
        {
            int res = 0;
            if (PD.puzzleType == 2)
            {
                if (board1.launchInfo.launching)
                {
                    res = 1;
                }
            }
            else if (PD.puzzleType == 1)
            {
                if (board1.shifting != 0)
                {
                    res = 2;
                }
            }
            hud.DoUpdate(paused, board1.GetScore(), res);
            if (hud.lose && !board2.IsDead())
            {
                board1.BeDefeated();
            }
        }
        else
        {
            hud.DoUpdate(paused, board1.GetScore(), board2.GetScore());
        }
    }