Advertisement
gizoncio

Breakout aula 13 - GameManager.cs

Jun 4th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 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.     // Use this for initialization
  20.     void Start () {
  21.         scriptPlayer = GameObject.Find("player").GetComponent<player>();
  22.         renderBolinha = GameObject.Find("ball").GetComponent<SpriteRenderer>();
  23.     }
  24.    
  25.     // Update is called once per frame
  26.     void Update () {
  27.         if (scriptPlayer.podeAtirar && !scriptPlayer.ativaExplosao)
  28.             renderBolinha.sprite = sprBolinha[1];
  29.         else if (!scriptPlayer.podeAtirar && scriptPlayer.ativaExplosao)
  30.             renderBolinha.sprite = sprBolinha[2];
  31.         else
  32.             renderBolinha.sprite = sprBolinha[0];
  33.  
  34.         if (scriptPlayer.podeAtirar && scriptPlayer.ativaExplosao)
  35.             renderBolinha.color = Color.yellow;
  36.         else
  37.             renderBolinha.color = Color.white;
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement