Example #1
0
    public void SetPoints()
    {
        int AddPoints = 0;

        if (CurrentType == GroundType.GROUND)
        {
            Lives--;
            playModeUIController.updateLivesBar(Lives);
            if (Lives <= 0)
            {
                playModeUIController.activePlayModeUI(false);
                gameOverUI.setGameOverUi((int)pointsValue, (int)bestPointsValue);
                gameOverUI.gameObject.SetActive(true);
                hoist.GameStarted = false;
                StartScreen.instance.IsStartScreen = true;
            }
            else
            {
                BonusControl.ShowHealthPoints("-");
            }
        }
        else if (CurrentType == GroundType.DOUBLE_DIAMOND || CurrentType == GroundType.DOUBLE_GREEN || CurrentType == GroundType.DOUBLE_RUBIN || CurrentType == GroundType.DOUBLE_YELLOW)
        {
            AddPoints = PointsDatabase.instance.GetNumberOfPoints(CurrentType) * level * 2;
            BonusControl.ShowAdmireText();
            if (Lives < 3 && Lives > 0)
            {
                Lives++;
                playModeUIController.updateLivesBar(Lives);
            }
        }
        else
        {
            AddPoints = PointsDatabase.instance.GetNumberOfPoints(CurrentType) * level;
        }


        if (AddPoints > 0)
        {
            ActiveComboValue++;
            pointsValue += AddPoints;
        }
        else if (AddPoints < 0)
        {
            if (ActiveComboValue > BestComboValue)
            {
                BestComboValue = ActiveComboValue;
            }
            ActiveComboValue = 0;
        }

        playModeUIController.setPointsText((int)pointsValue);


        if (bestPointsValue < pointsValue)
        {
            bestPointsValue = pointsValue;
        }


        //TODO:(B) END GAME, By setting "IsStartScreen" to true, we reset the game and show player EndGameUI with option to restart, INT pointsValue is variable which controls amount of points, between each Level this var is saved, NOT BETWEEN STAGES!
        CurrentType = GroundType.EMPTY;
    }