void Awake() { gerenJogo = FindObjectOfType <GerenciadorJogo>(); tr = GetComponent <Transform>(); #if UNITY_EDITOR DEBUG_AtualizaPreverTr(); #endif }
// na primeira inicializacao do componente void Awake() { // garante que apenas uma instancia desse componente exista if(GerenciadorJogo.instancia != null) { Destroy(gameObject); } else { instancia = this; // guarda uma referencia a essa instancia na classe estatica DontDestroyOnLoad(transform.gameObject); // evita que esse objeto seja destruido quando troca de cena } }
// Start is called before the first frame update void Awake() { if (gerenciadorJogo == null) { gerenciadorJogo = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
private void Awake() { if (instancia == null) { instancia = this; Inicializar(); } else if (instancia != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
public void Jogo_Jogador1NaoInformado_ThrowException() { Jogador jogador1 = null; var jogador2 = new Jogador("GODOY"); var gerenciadorPontuacaoAleatoria = new GerenciadorPontuacaoAleatoria(); var gerenciadorPontuacaoJogo = new GerenciadorPontuacaoJogo(); var telaJogo = new GerenciadorTelaJogo(); var gerenciadorJogo = new GerenciadorJogo( gerenciadorPontuacaoAleatoria, gerenciadorPontuacaoJogo, telaJogo, jogador1, jogador2); }
public void Jogo_TelaJogoNulo_ThrowException() { var jogador1 = new Jogador("DANILO"); var jogador2 = new Jogador("GODOY"); var gerenciadorPontuacaoAleatoria = new GerenciadorPontuacaoAleatoria(); var gerenciadorPontuacaoJogo = new GerenciadorPontuacaoJogo(); GerenciadorTelaJogo telaJogo = null; var gerenciadorJogo = new GerenciadorJogo( gerenciadorPontuacaoAleatoria, gerenciadorPontuacaoJogo, telaJogo, jogador1, jogador2); }
public void Jogo_JogadoresComMesmoNome_ThrowException() { var jogador1 = new Jogador("DANILO"); var jogador2 = new Jogador("DANILO"); var gerenciadorPontuacaoAleatoria = new GerenciadorPontuacaoAleatoria(); var gerenciadorPontuacaoJogo = new GerenciadorPontuacaoJogo(); var telaJogo = new GerenciadorTelaJogo(); var gerenciadorJogo = new GerenciadorJogo( gerenciadorPontuacaoAleatoria, gerenciadorPontuacaoJogo, telaJogo, jogador1, jogador2); }
public void Jogo_Jogador2SempreFazPontos_Jogador2Vence() { var jogador1 = new Jogador("DANILO"); var jogador2 = new Jogador("GODOY"); var gerenciadorPontuacaoAleatoria = new Fake_Jogador2SempreVence(); var gerenciadorPontuacaoJogo = new GerenciadorPontuacaoJogo(); var telaJogo = new Fake_TelaJogo(); var gerenciadorJogo = new GerenciadorJogo( gerenciadorPontuacaoAleatoria, gerenciadorPontuacaoJogo, telaJogo, jogador1, jogador2); var vencedor = gerenciadorJogo.Jogar(); Assert.AreEqual(jogador2.Nome, vencedor); }
static void Main(string[] args) { try { var jogador1 = new Jogador("Danilo"); var jogador2 = new Jogador("Godoy"); var resultadoJogoAleatorio = new GerenciadorPontuacaoAleatoria(); var gerenciadorPontuacaoJogo = new GerenciadorPontuacaoJogo(); var telaJogo = new GerenciadorTelaJogo(); var gerenciadorJogo = new GerenciadorJogo(resultadoJogoAleatorio, gerenciadorPontuacaoJogo, telaJogo, jogador1, jogador2); gerenciadorJogo.Jogar(); } catch (Exception ex) { Console.WriteLine(ex); } }
void Awake() { tr = GetComponent <Transform>(); gerenJogo = FindObjectOfType <GerenciadorJogo>(); diarioBt = FindObjectOfType <DiarioBt>(); }
void Start() { gerenJogo = FindObjectOfType <GerenciadorJogo>(); }
// Use this for initialization void Awake() { instancia = this; }
private void Start() { gerenciadorJogo = GameObject.FindGameObjectWithTag("GameController").GetComponent <GerenciadorJogo>(); }
void Awake() { gerenJogo = FindObjectOfType <GerenciadorJogo>(); }
void Awake() { gerenJogo = FindObjectOfType <GerenciadorJogo>(); tr = GetComponent <Transform>(); }