Пример #1
0
 //konstruktori ettei tarvi erikseen asettaa arvoja...
 public CharacterData(CharacterStats stats)
 {
     name       = ScoreTable.currentPlayer;
     score      = ScoreTable.GetScore(ScoreTable.currentPlayer, "score");
     cCharLevel = CharacterStats.currentCharacterLevel;
     cCharXP    = stats.currentCharacterXP;
     lPojo      = CharacterStats.levelPojo + CharacterStats.currentCharacterLevel * 2 - 2;
     str        = CharacterStats.strength;
     dex        = CharacterStats.dexterity;
     vit        = CharacterStats.vitality;
     ene        = CharacterStats.energy;
     mHealth    = stats.maxHealth;
     mMana      = stats.maxMana;
     rHealth    = stats.replenishH;
     rMana      = stats.replenishM;
     fMoveSpeed = stats.moveSpeed;
     rotSpeed   = stats.rotationSpeed;
     bMoveSpeed = stats.BackwardsMoveSpeed;
     jForce     = stats.jumpForce;
     _Level1    = GameStatus.Level1;
     _Level2    = GameStatus.Level2;
     _Level3    = GameStatus.Level3;
     _Level4    = GameStatus.Level4;
     _Level5    = GameStatus.Level5;
 }
Пример #2
0
    public void OpenHighScore()
    {
        if (ScoreTable.playerScores == null)
        {
            Debug.Log("No scoreTable");
            return;
        }

        ScoreTable.LoadAllScores();

        string[] players = ScoreTable.GetPlayers();

        foreach (string name in players)
        {
            GameObject obj = Instantiate(playerScorePrefab);
            obj.transform.SetParent(this.transform);
            obj.transform.Find("Name").GetComponent <Text>().text   = name;
            obj.transform.Find("Value1").GetComponent <Text>().text = ScoreTable.GetScore(name, "level").ToString();
            obj.transform.Find("Value2").GetComponent <Text>().text = ScoreTable.GetScore(name, "score").ToString();
        }
    }
Пример #3
0
 public void StartGame()
 {
     if (textField.text.Length > 0 && !PlayerPrefs.HasKey(textField.text))
     {
         GameStatus.gameBegin = true;
         PlayerPrefs.SetString(textField.text, textField.text);
         PlayerPrefs.SetInt(textField.text + "levels", 1);
         PlayerPrefs.SetInt(textField.text + "scores", 0);
         //testing ways to do highscore
         ScoreTable.SetScore(textField.text, "level", 1);
         ScoreTable.SetScore(textField.text, "score", 0);
         ScoreTable.currentPlayer = textField.text;
         ScoreTable.SaveScores();
         Debug.Log("New Challenger! Name: " + textField.text + " Level: " + ScoreTable.GetScore(textField.text, "level") + ", Score: " + ScoreTable.GetScore(textField.text, "score"));
         SceneManager.LoadScene("Map");
     }
     else if (PlayerPrefs.HasKey(textField.text))
     {
         ScoreTable.currentPlayer = textField.text;
         Debug.Log(PlayerPrefs.GetString(textField.text));
         ScoreTable.LoadScores();
         SceneManager.LoadScene("Map");
     }
 }
Пример #4
0
 private void Start()
 {
     scoreText      = gameObject.GetComponent <Text>();
     scoreText.text = ScoreTable.GetScore(ScoreTable.currentPlayer, "score").ToString();
 }
Пример #5
0
 void Update()
 {
     scoreText.text = ScoreTable.GetScore(ScoreTable.currentPlayer, "score").ToString();
 }