void Update()
 {
     if (networkView.isMine)
     {
         string datas = PlayerName + ";" + MaxHealth.ToString() + ";" + Health.ToString() + ";" + RedBalls.ToString() + ";" + YellowBalls.ToString() + ";" + GreenBalls.ToString()
                        + ";" + NbCollectedFragments.ToString();
         networkView.RPC("SynchronizePlayerDatas", RPCMode.Others, datas);
         AdjustHealth(0);
     }
 }
        public XmlElement Serialize(XmlDocument doc)
        {
            XmlElement xmlStats = doc.CreateElement("stats");

            xmlStats.SetAttribute("health", Health.ToString());
            xmlStats.SetAttribute("maxHealth", MaxHealth.ToString());
            xmlStats.SetAttribute("endurance", Endurance.ToString());
            xmlStats.SetAttribute("strength", Strength.ToString());
            xmlStats.SetAttribute("intelligence", Intelligence.ToString());
            xmlStats.SetAttribute("agility", Agility.ToString());
            xmlStats.SetAttribute("dexterity", Dexterity.ToString());
            xmlStats.SetAttribute("upgradePoint", UpgradePoint.ToString());

            return(xmlStats);
        }
Exemple #3
0
    public string StatsDisplay()
    {
        string stats = ("Wizard Joey: \n"
                        + "\nHealth: " + Health.ToString() + "/" + MaxHealth.ToString()
                        + "\nMana: " + Mana.ToString() + "/" + MaxMana.ToString()
                        + "\nHealth Regen: " + statsScript.HealthRegenStat.ToString() + " per second"
                        + "\nMana Regen: " + statsScript.ManaRegenStat.ToString() + " per second"
                        /*+ "\nGold: " + gold.ToString()*/
                        + "\n" + Armor);

        // + "\nCurrent Experience: " + experience.ToString() + "/" + nextLvlExp.ToString());
        // StatsText.text = ("Wizard Joey: \n"
        //     + "\nHealth: " + health.ToString() + "/" + maxHealth.ToString()
        //     + "\nMana: " + mana.ToString() + "/" + maxMana.ToString()
        //     + "\nGold: " + gold.ToString()
        //     //+ "\nArmor: " + Armor.ToString()
        //     + "\nCurrent Experience: " + experience.ToString() + "/" + nextLvlExp.ToString());
        return(stats);
    }
    private void Start()
    {
        // Health starts and resets to full when starting game again
        MaxHealth       = 100f;
        CurrentHealth   = MaxHealth;
        healthBar.value = MaxHealth;
        Debug.Log("Health is " + healthBar.value);
        currentHealthPoints.text = MaxHealth.ToString();

        // Energy starts and resets to 0 when starting game again
        MaxEnergy       = 0f;
        CurrentEnergy   = MaxEnergy;
        energyBar.value = MaxEnergy;
        Debug.Log("Health is " + healthBar.value);
        currentEnergyPoints.text = MaxEnergy.ToString();

        ScoreScript.scoreValue = 0;
        restartButton.SetActive(false);
        exitButton.SetActive(false);
        gameOverText.SetActive(false);
        gameOverScoreText.SetActive(false);
        gameOverScoreNum.SetActive(false);
    }