Пример #1
0
    public void StartNewGame()
    {
        if (this.currentlyActiveQuestObject != null)
        {
            Destroy(this.currentlyActiveQuestObject.gameObject);
            this.currentlyActiveQuestObject = null;
        }

        if (this.currentlyUsedBullet != null)
        {
            Destroy(this.currentlyUsedBullet.gameObject);
            this.currentlyUsedBullet           = null;
            this.weaponController.loadedBullet = null;
        }

        this.weaponController.Resume();
        this.currentlyUsedBullet = this.weaponController.LoadNewBullet().GetComponent <BulletComponent>();
        this.currentlyUsedBullet.AddListenerToBullet(this.OnBulletDeactivation);

        this.currentlyUsedBullet = this.weaponController.LoadNewBullet().GetComponent <BulletComponent>();
        this.currentlyUsedBullet.AddListenerToBullet(this.OnBulletDeactivation);

        this.thisLevelSpawnCountGoal = Player.playerProgressData[this.currentlySelectedProblem].levelsSpawnCount[this.currentLevel];
        this.spawnCount = 1;
        this.UpdateSpawnCount();

        this.SpawnNewQuestion(ProblemManager.GetNewQuestion(this.currentlySelectedProblem, this.currentLevel, this.spawnCount));

        this.isAGameRunning = true;
    }
Пример #2
0
    public void OnCorrectNumberHit()
    {
        this.messageHolderText.text = "CORRECT!";

        Destroy(this.currentlyActiveQuestObject.gameObject);
        this.currentlyActiveQuestObject = null;

        this.UpdatePlayerResources(1);

        this.spawnCount++;
        if (this.spawnCount > this.thisLevelSpawnCountGoal)
        {
            this.currentLevel++;

            if (!Player.playerProgressData[this.currentlySelectedProblem].levels.ContainsKey(this.currentLevel))
            {
                this.currentLevel--;
            }
            else
            {
                this.levelText.text = this.currentLevel.ToString();
                Player.playerProgressData[this.currentlySelectedProblem].levels[this.currentLevel] = true;
                Player.Save();
            }

            this.spawnCount = 1;
        }
        this.UpdateSpawnCount();

        this.SpawnNewQuestion(ProblemManager.GetNewQuestion(this.currentlySelectedProblem, this.currentLevel, this.spawnCount));
    }