public void setActive(bool state, difficult Diff = difficult.DIFFICULT_EASY)
    {
        if (state == true)
        {
            gameObject.SetActive(true);
            activeLevel  = 0;
            slider.value = 0;
            Difficult    = Diff;
            active       = true;

            switch (Difficult)
            {
            case difficult.DIFFICULT_EASY:
                activeDifficult = LevelManager.easyLevels;
                break;

            case difficult.DIFFICULT_MEDIUM:
                activeDifficult = LevelManager.mediumLevels;
                break;

            case difficult.DIFFICULT_HARD:
                activeDifficult = LevelManager.hardLevels;
                break;
            }
            slider.maxValue = activeDifficult.Count;
            updateLevel();
        }
        else
        {
            gameObject.SetActive(false);
            active = false;
        }
    }
    public void setActive(bool state, difficult Diff = difficult.DIFFICULT_EASY)
    {
        if (state == true)
        {
            gameObject.SetActive(true);
            activeLevel = 0;
            slider.value = 0;
            Difficult = Diff;
            active = true;

            switch(Difficult)
            {
                case difficult.DIFFICULT_EASY:
                    activeDifficult = LevelManager.easyLevels;
                    break;
                case difficult.DIFFICULT_MEDIUM:
                    activeDifficult = LevelManager.mediumLevels;
                    break;
                case difficult.DIFFICULT_HARD:
                    activeDifficult = LevelManager.hardLevels;
                    break;
            }
            slider.maxValue = activeDifficult.Count;
            updateLevel();
        }
        else
        {
            gameObject.SetActive(false);
            active = false;
        }
    }
Exemple #3
0
    // This is the setter for the change-able square base on the difficulty player choose
    private List <List <bool> > setCanChange(difficult diff)
    {
        List <List <bool> > sudokuCanChange = new List <List <bool> >();

        for (int i = 0; i < 9; i++)
        {
            List <bool> r = new List <bool>();
            for (int j = 0; j < 9; j++)
            {
                r.Add(false);
            }
            sudokuCanChange.Add(r);
        }

        // The following code is for setting the input space base on what level player choose
        int count = 0;

        System.Random rand = new System.Random();
        // Easy will require less input space
        if (diff == difficult.easy)
        {
            count = 35;
            player.Sudoku.difficulty_level = 1;
        }
        // Medium will increase by 10
        if (diff == difficult.medium)
        {
            count = 45;
            player.Sudoku.difficulty_level = 2;
        }
        // Hard will increase by another 10
        if (diff == difficult.hard)
        {
            count = 55;
            player.Sudoku.difficulty_level = 3;
        }
        do
        {
            int rowIndex = rand.Next(0, 9);
            int colIndex = rand.Next(0, 9);
            if (sudokuCanChange[rowIndex][colIndex] == false)
            {
                sudokuCanChange[rowIndex][colIndex] = true;
                count--;
            }
        } while (count >= 0);
        return(sudokuCanChange);
    }
Exemple #4
0
    private List <List <bool> > setCanChange(difficult diff)
    {
        List <List <bool> > sudokuCanChange = new List <List <bool> >();

        for (int i = 0; i < 9; i++)
        {
            List <bool> r = new List <bool>();
            for (int j = 0; j < 9; j++)
            {
                r.Add(false);
            }
            sudokuCanChange.Add(r);
        }
        int count = 0;

        System.Random rand = new System.Random();
        if (diff == difficult.easy)
        {
            count            = 35;
            difficulty_level = 1;
        }
        if (diff == difficult.medium)
        {
            count            = 45;
            difficulty_level = 2;
        }
        if (diff == difficult.hard)
        {
            count            = 55;
            difficulty_level = 3;
        }
        do
        {
            int rowIndex = rand.Next(0, 9);
            int colIndex = rand.Next(0, 9);
            if (sudokuCanChange[rowIndex][colIndex] == false)
            {
                sudokuCanChange[rowIndex][colIndex] = true;
                count--;
            }
        } while (count >= 0);
        return(sudokuCanChange);
    }