Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        translator = FindObjectOfType <UILanguages>();
        var json = JSON.Parse(tipJSON.ToString());

        tips       = json["tips"].AsArray;
        displayTip = tips[Random.Range(0, tips.Count)];
        displayTip = translator.Translate(displayTip);
        GetComponent <Text>().text = displayTip;
    }
Ejemplo n.º 2
0
 private void UpdateScore()
 {
     textScore.text = translator.Translate("Score") + score;
     //textScore.text = "Score: " + score;
     OnScoreChanged(score);
 }
Ejemplo n.º 3
0
 void Start()
 {
     translator = FindObjectOfType <UILanguages>();
     GetComponent <Text>().text = translator.Translate(translationKey);
 }
Ejemplo n.º 4
0
    // Callback function for GameFlow.GameLost.
    void Appear(GameFlow.GameOverCause cause)
    {
        AudioController.Instance.StopSFX("About_To_Lose_1");
        AudioController.Instance.PlaySFX("Game_Over_1");

        foreach (GameObject obj in toBeEnabled)
        {
            obj.SetActive(true);
        }

        string reason;

        switch (cause)
        {
        case GameFlow.GameOverCause.NoRemainingSpaces:
            reason = "ReasonNoSpaceLeft";
            break;

        case GameFlow.GameOverCause.QueueOverflow:
            reason = "ReasonHesitation";
            break;

        case GameFlow.GameOverCause.NoMoreEnergy:
            reason = "ReasonNoEnergy";
            break;

        case GameFlow.GameOverCause.Reset:
            reason = "ReasonManualReset";
            break;

        default:
            reason = "ReasonHesitation";
            break;
        }

        string prefsEntry;

        if (Settings.Instance.IsZenModeEnabled())
        {
            prefsEntry = "HighScoreZen";
        }
        else
        {
            prefsEntry = "HighScore";
        }

        int highScore  = PlayerPrefs.GetInt(prefsEntry); //Get the stored high score - 0 if doesn't exist
        int finalScore = score.GetScore();

        if (finalScore > highScore)
        {
            highScore = finalScore;
            PlayerPrefs.SetInt(prefsEntry, highScore); //Save it
        }

        analytics.SendData(cause, highScore);

        textGameOverReason.text = translator.Translate(reason) + "\n"
                                  + translator.Translate("HighScore1") + highScore;
        //textGameOverReason.text = reason + "\nHigh score: " + highScore;
    }