Example #1
0
 public void DecrementaVida()
 {
     if (MovimentoInicial == false && GameObject.FindGameObjectsWithTag("Inimigo").Length + GameObject.FindGameObjectsWithTag("Boss").Length > 0)
     {
         vida -= 1;
         if (scene.name == "Infinite")
         {
             controladorInfinito.DecrementaVidaHud(vida);
         }
         else if (scene.name == "Scene_1" || scene.name == "Campanha_1" || scene.name == "Campanha_2" || scene.name == "Campanha_3")
         {
             controladorNormal.DecrementaVidaHud(vida);
         }
     }
     if (vida <= 0)
     {
         Instantiate(explosao, this.gameObject.transform.position, this.gameObject.transform.rotation);
         Destroy(this.gameObject);
     }
 }
Example #2
0
 void Start()
 {
     arma = GameObject.FindGameObjectWithTag("ArmaPlayer").GetComponent <Arma>();
     if (scene.name == "Infinite")
     {
         controladorInfinito = GameObject.FindGameObjectWithTag("GameController").GetComponent <ControladorInifinito>();
         controladorInfinito.DecrementaVidaHud(vida);
         controladorInfinito.vida.maxValue = this.vidamax;
     }
     else if (scene.name == "Scene_1" || scene.name == "Campanha_1" || scene.name == "Campanha_2" || scene.name == "Campanha_3")
     {
         controladorNormal = GameObject.FindGameObjectWithTag("GameController").GetComponent <Controlador>();
         controladorNormal.DecrementaVidaHud(vida);
         controladorNormal.vida.maxValue = this.vidamax;
     }
     cores               = Renderizador.color;
     TempoInicial        = 2;
     MovimentoInicial    = true;
     normalfirerate      = arma.fireRate;
     Inimigos            = GameObject.FindGameObjectsWithTag("Inimigo");
     SpriteSelecionado   = PlayerPrefs.GetInt("sprite");
     Renderizador.sprite = SpritesPlayers[SpriteSelecionado];
 }