public void restartGame()
    {
        ProgressSerial.getInstance().restartData();
        ProgressSerial.getInstance().saveData();

        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
Ejemplo n.º 2
0
    public void showResult(bool isVictory)
    {
        monsterKilled.text = GameplayCounter.getInstance().MonsterKilled.ToString();
        rubyCollected.text = GameplayCounter.getInstance().RubyCollected.ToString();

        if (isVictory)
        {
            statusText.sprite = spVictory;
            expGained.text    = "+ 100";
            nextLevelButton.SetActive(true);
        }
        else
        {
            statusText.color  = new Color(1f, 0f, 0f);
            statusText.sprite = spDefeat;
            expGained.text    = "+ 0";
            nextLevelButton.SetActive(false);
        }

        ProgressSerial progressSerial = ProgressSerial.getInstance();

        progressSerial.RubyToSave += GameplayCounter.getInstance().RubyCollected;
        progressSerial.ExpToSave  += isVictory ? 100 : 0;
        progressSerial.saveData();


        gameplayUI.SetActive(false);
        resultPanel.SetActive(true);
    }
Ejemplo n.º 3
0
    private void Start()
    {
        alertText.SetActive(false);
        NPCName.SetActive(false);

        characterLvl   = new CharacterLevel();
        progressSerial = ProgressSerial.getInstance();
    }
 public void onUserClickYesNo(int choice)
 {
     if (choice == 1)
     {
         ProgressSerial.getInstance().saveData();
         Application.Quit();
     }
     else
     {
         exitPanel.SetActive(false);
     }
 }
 public void continueGame()
 {
     if (ProgressSerial.getInstance().checkExist())
     {
         ProgressSerial.getInstance().loadData();
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
     }
     else
     {
         restartGame();
     }
 }
    public double calculateLevel()
    {
        long currentExp = ProgressSerial.getInstance().ExpToSave;

        double level = 1;

        for (int i = 0; i < expStage.Length; i++)
        {
            if (currentExp > expStage[i])
            {
                currentExp -= expStage[i];
                level++;
            }
            else
            {
                level += currentExp * 1.0 / expStage[i];
                break;
            }
        }

        return(level);
    }