Exemple #1
0
    public void ResetProblem()
    {
        DropZone.ClearDropzone(playerTable);
        DropZone.ClearDropzone(playerWallet);
        currentBalance = 0;
        toggleCounter++;

        if (toggleCounter == toggleThreshold)
        {
            if (UnityEngine.Random.Range(0, 2) == 1)
            {
                toggleMoneyShown = true;
            }
            else
            {
                toggleMoneyShown = false;
            }
            Debug.Log("Toggle money shown!! " + toggleMoneyShown);
            toggleCounter = 0;
        }
        probGen.GenerateNewProblem(); //duplicate?
        probGen.requiredAmount = ProblemManager.newProblem.GetUSDSum();
        bombExplosionAnimation.SetActive(false);
        isGameOver = false;
    }
    void Start()
    {
        taskInfo.SetActive(false);
        mapButton.SetActive(true);
        spriteRenderer  = GetComponent <SpriteRenderer>();
        this.isUnlocked = false;

        if (Player.playerProgressData.ContainsKey(this.problem))
        {
            spriteRenderer.sprite = unlockedSprite;
            this.isUnlocked       = true;
        }
        else
        {
            if (Player.intelligenceAmount >= (int)this.problem * IntelliganceBetweenProblems)
            {
                Player.playerProgressData.Add(this.problem, ProblemManager.GenerateNewProblem(this.problem));
                Player.Save();

                spriteRenderer.sprite = unlockedSprite;
                this.isUnlocked       = true;
            }
            else
            {
                spriteRenderer.sprite = lockedSprite;
            }
        }
    }
Exemple #3
0
    public void OnClickStartGame()
    {
        // Mocking player data

        /*  Player.intelligenceAmount = 150;
         * Player.playerProgressData =
         * Player.playerProgressData.Add(Problem.Addition, ProblemManager.GenerateNewProblem(Problem.Addition));
         * Player.playerProgressData.Add(Problem.Subtraction, ProblemManager.GenerateNewProblem(Problem.Subtraction)); */
        // -------------

        if (!Player.Load())
        {
            Player.playerProgressData = new Dictionary <Problem, ProblemData>();
            Player.playerProgressData.Add(Problem.Addition, ProblemManager.GenerateNewProblem(Problem.Addition));
            Player.selectedProblem    = Problem.Addition;
            Player.intelligenceAmount = 0;

            if (!Player.Save())
            {
                Debug.LogError("Couldn't save player data!");
            }

            Debug.Log("New Player data was created and saved!");
        }
        else
        {
            Debug.Log("Player data loaded successfully!");
        }

        StartCoroutine(PlayButtonClickSound());

        GameStateManager.TransitionToScene(GameScene.Home);
    }