Advertisement
gizoncio

Breakout aula 14 - GameManager.cs

Jun 5th, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 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 System.Collections;
  9. using System.Collections.Generic;
  10.  
  11. public class gameManager : MonoBehaviour {
  12.  
  13.     public SpriteRenderer renderBolinha;
  14.  
  15.     private player scriptPlayer;
  16.  
  17.     public Sprite[] sprBolinha;
  18.  
  19.     public int pontuacao;
  20.  
  21.     // Use this for initialization
  22.     void Start () {
  23.         pontuacao = 0;
  24.         scriptPlayer = GameObject.Find("player").GetComponent<player>();
  25.         renderBolinha = GameObject.Find("ball").GetComponent<SpriteRenderer>();
  26.     }
  27.    
  28.     // Update is called once per frame
  29.     void Update () {
  30.  
  31.         Debug.Log(pontuacao);
  32.  
  33.         if (scriptPlayer.podeAtirar && !scriptPlayer.ativaExplosao)
  34.             renderBolinha.sprite = sprBolinha[1];
  35.         else if (!scriptPlayer.podeAtirar && scriptPlayer.ativaExplosao)
  36.             renderBolinha.sprite = sprBolinha[2];
  37.         else
  38.             renderBolinha.sprite = sprBolinha[0];
  39.  
  40.         if (scriptPlayer.podeAtirar && scriptPlayer.ativaExplosao)
  41.             renderBolinha.color = Color.yellow;
  42.         else
  43.             renderBolinha.color = Color.white;
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement