Advertisement
gizoncio

Breakout aula 15 - gameManager.cs

Aug 18th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. //////////////////////////////////////////////
  2. // Créditos Équilibré Cursos e Treinamentos //
  3. // http://www.equilibrecursos.net           //
  4. // http://www.youtube.com/equilibrecursos   //
  5. //////////////////////////////////////////////
  6.  
  7. using UnityEngine;
  8. using UnityEngine.UI;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11.  
  12. public class gameManager : MonoBehaviour {
  13.  
  14.     public SpriteRenderer renderBolinha;
  15.  
  16.     private player scriptPlayer;
  17.  
  18.     public Sprite[] sprBolinha;
  19.  
  20.     public Text ScoreText;
  21.  
  22.     public int pontuacao;
  23.  
  24.     // Use this for initialization
  25.     void Start () {
  26.         pontuacao = 0;
  27.         scriptPlayer = GameObject.Find("player").GetComponent<player>();
  28.         renderBolinha = GameObject.Find("ball").GetComponent<SpriteRenderer>();
  29.     }
  30.    
  31.     // Update is called once per frame
  32.     void Update () {
  33.  
  34.         ScoreText.text = pontuacao.ToString();
  35.  
  36.         if (scriptPlayer.podeAtirar && !scriptPlayer.ativaExplosao)
  37.             renderBolinha.sprite = sprBolinha[1];
  38.         else if (!scriptPlayer.podeAtirar && scriptPlayer.ativaExplosao)
  39.             renderBolinha.sprite = sprBolinha[2];
  40.         else
  41.             renderBolinha.sprite = sprBolinha[0];
  42.  
  43.         if (scriptPlayer.podeAtirar && scriptPlayer.ativaExplosao)
  44.             renderBolinha.color = Color.yellow;
  45.         else
  46.             renderBolinha.color = Color.white;
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement