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
     }
 }
示例#3
0
    // Start is called before the first frame update
    void Awake()
    {
        if (gerenciadorJogo == null)
        {
            gerenciadorJogo = this;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
示例#4
0
    private void Awake()
    {
        if (instancia == null)
        {
            instancia = this;
            Inicializar();
        }
        else if (instancia != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }
示例#9
0
        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>();
 }
示例#11
0
 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>();
 }
示例#15
0
 void Awake()
 {
     gerenJogo = FindObjectOfType <GerenciadorJogo>();
     tr        = GetComponent <Transform>();
 }