Ejemplo n.º 1
0
 private void OnCurrentHealthUpdated(int currentHealth)
 {
     if (currentHealth <= 0)
     {
         counter.SetPlayerCount(-1);
     }
 }
Ejemplo n.º 2
0
    private void OnCurrentHealthUpdated(int currentHealth)
    {
        if (HealthReader.Authority == Authority.NotAuthoritative)
        {
            HealthBar = GameObject.Find("Slider").GetComponent <Slider> ();
            TextBar   = GameObject.Find("Slider").GetComponentsInChildren <Text> ();
            foreach (Text text in TextBar)
            {
                healthText = text;
            }
            HealthBar.value = currentHealth;
            healthText.text = currentHealth.ToString();
        }

        //Display LOSE
        if (currentHealth <= 0 && !dead)
        {
            dead          = true;
            loseText.text = "YOU LOSE!";
            counter.SetPlayerCount(-1);
        }
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     counter = GameObject.FindGameObjectWithTag("WinText").GetComponent <PlayersCounter>();
     counter.SetPlayerCount(1);
 }