Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (OT.Clicked(GameObject.Find("asteroid-1").GetComponent <OTAnimatingSprite>()))
     {
         GameObject.Find("asteroid-1").GetComponent <OTAnimatingSprite>().Reverse();
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (Input.touchCount >= 1)
            {
                foreach (Touch touch in Input.touches)
                {
                    if (touch.phase == TouchPhase.Began)
                    {
                        Ray        ray = camera1.ScreenPointToRay(touch.position);
                        RaycastHit hit;

                        if (Physics.Raycast(ray, out hit))
                        {
                            switch (hit.collider.name)
                            {
                            case "ButtonLeft":
                            {
                                c.previousImg();
                                break;
                            }

                            case "ButtonRight":
                            {
                                if (!esq)
                                {
                                    c.nextImg();
                                }

                                break;
                            }
                            }
                        }
                    }
                }
            }
        }
        else//PC
        {
            if (OT.Clicked(this.gameObject, 0))
            { // Verifica se colidiu com mouse
                if (!esq)
                {
                    c.nextImg();
                }
                else
                {
                    c.previousImg();
                }
            }
        }
    }
    void Update()
    {
        if (OT.Over(buttonExit))
        {
            MySprite.frameIndex = 1;
        }
        else
        {
            MySprite.frameIndex = 0;
        }

        if (OT.Clicked(buttonExit))
        {
            MySprite.frameIndex = 2;
            Application.Quit();
        }
    }
Exemplo n.º 4
0
    void Update()
    {
        if (OT.Over(buttonPlay))
        {
            MySprite.frameIndex = 1;
        }
        else
        {
            MySprite.frameIndex = 0;
        }

        if (OT.Clicked(buttonPlay))
        {
            MySprite.frameIndex = 2;
            Time.timeScale      = 1;
            Application.LoadLevel("MainScene");
        }
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (isAndroid ||
            isiOS)
        {
            if (Input.touchCount >= 1)
            {
                foreach (Touch touch in Input.touches)
                {
                    if (touch.phase == TouchPhase.Began)
                    {
                        Ray        ray = camera1.ScreenPointToRay(touch.position);
                        RaycastHit hit;

                        if (Physics.Raycast(ray, out hit))
                        {
                            switch (hit.collider.name)
                            {
                            case "Button_Ampli":
                            {
                                Application.OpenURL(@link);
                            }
                            break;

                            case "Button_Atomic":
                            {
                                Application.OpenURL(@link);
                            }
                            break;
                            }
                        }
                    }
                }
            }
        }
        else//PC
        {
            if (OT.Clicked(this.gameObject))
            {
                Application.OpenURL(@link);
            }
        }
    }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        /*
         *      if(OT.Clicked(this.gameObject, 0) || OT.Touched(this.gameObject))
         * { // Verifica se colidiu com mouse ou touch;
         *              Application.LoadLevel("Tela_Creditos");
         *      }
         * */

        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (Input.touchCount >= 1)
            {
                foreach (Touch touch in Input.touches)
                {
                    if (touch.phase == TouchPhase.Began)
                    {
                        Ray        ray = camera1.ScreenPointToRay(touch.position);
                        RaycastHit hit;

                        if (Physics.Raycast(ray, out hit))
                        {
                            switch (hit.collider.name)
                            {
                            case "ButtonCredits":
                                Application.LoadLevel("Tela_Creditos");
                                break;
                            }
                            //hit.transform.SendMessage("Clicked");
                        }
                    }
                }
            }
        }
        else//PC
        {
            if (OT.Clicked(this.gameObject, 0))
            { // Verifica se colidiu com mouse ou touch;
                Application.LoadLevel("Tela_Creditos");
            }
        }
    }
    void Update()
    {
        if (OT.Over(buttonBack))
        {
            MySprite.frameIndex = 1;
        }
        else
        {
            MySprite.frameIndex = 0;
        }

        if (OT.Clicked(buttonBack))
        {
            MySprite.frameIndex = 2;
            Time.timeScale      = 1;
            EnteringZone.isBack = true;
            Destroy(scene);
        }
    }
Exemplo n.º 8
0
    // Update is called once per frame
    void Update()
    {
        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (Input.touchCount >= 1)
            {
                foreach (Touch touch in Input.touches)
                {
                    if (touch.phase == TouchPhase.Began)
                    {
                        Ray        ray = camera1.ScreenPointToRay(touch.position);
                        RaycastHit hit;

                        if (Physics.Raycast(ray, out hit))
                        {
                            switch (hit.collider.name)
                            {
                            case "ButtonExit":
                            {
                                Application.Quit();
                            }
                            break;
                            }
                            //hit.transform.SendMessage("Clicked");
                        }
                    }
                }
            }
        }
        else //PC
        {
            if (OT.Clicked(this.gameObject))
            {
                Application.Quit();
            }
        }
    }
Exemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        //teste
        //var myCamera : Camera;
        //var hit : RaycastHit;
        //var ray : Ray;

        // if(Input.touchCount == 1)
        // {
        //    RaycastHit hit;

        //    Touch touch = Input.touches[0];
        //    Ray raio = camera.ScreenPointToRay(Input.touches[0].position);

        //    if(touch.phase == TouchPhase.Ended && Physics.Raycast(raio.origin, raio.direction, hit)){

        //    switch(hit.collider.name)
        //    {
        //        case "object01":
        //        Debug.Log("Object01 tapped");
        //        //things
        //        break;
        //        case "object02":
        //        Debug.Log("Object02 tapped");
        //        //things
        //        break;
        //    }
        //}

        //if (Input.touchCount == 1)
        //{
        //    // touch on screen
        //    if (Input.GetTouch(0).phase == TouchPhase.Began)
        //    {
        //        Ray ray = camera.ScreenPointToRay(Input.GetTouch(0).position);
        //        RaycastHit hit = new RaycastHit();

        //        if (Physics.Raycast(ray, out hit))
        //        {
        //            switch (hit.collider.name)
        //            {
        //                case "ButtonPlay":
        //                    Application.LoadLevel("Tela_Tutorial");
        //                    break;
        //            }
        //        }

        //        //    moving = Physics.Raycast (ray, out hit);

        //        //    if(moving)
        //        //{
        //        //    go = hit.transform.gameObject;
        //        //    Debug.Log("Touch Detected on : "+go.name);
        //        //}

        //    }
        //}

        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (Input.touchCount >= 1)
            {
                foreach (Touch touch in Input.touches)
                {
                    if (touch.phase == TouchPhase.Began)
                    {
                        Ray        ray = camera1.ScreenPointToRay(touch.position);
                        RaycastHit hit;

                        if (Physics.Raycast(ray, out hit))
                        {
                            switch (hit.collider.name)
                            {
                            case "ButtonPlay":
                            {
                                if (Application.loadedLevelName == "Tela_Fases")
                                {
                                    //Status refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent<Status>();

                                    if (refScriptStatus == null)
                                    {
                                        refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent <Status>();
                                    }

                                    refScriptStatus.ultimoBotaoSelID  = -1;
                                    refScriptStatus.refUltimoBotaoSel = null;
                                }

                                if (Application.loadedLevelName == "Tela_Principal")
                                {
                                    Application.LoadLevel("Tela_Tutorial");
                                }
                            }
                            break;

                            case "ButtonBack":
                            {
                                if (Application.loadedLevelName == "Tela_Fases")
                                {
                                    //Status refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent<Status>();
                                    if (refScriptStatus == null)
                                    {
                                        refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent <Status>();
                                    }

                                    refScriptStatus.ultimoBotaoSelID  = -1;
                                    refScriptStatus.refUltimoBotaoSel = null;
                                }

                                Application.LoadLevel("Tela_Tutorial");
                            }
                            break;
                            }
                            //hit.transform.SendMessage("Clicked");
                        }
                    }
                }
            }
        }
        else//pc?
        {
            if (OT.Clicked(this.gameObject, 0))
            {
                if (Application.loadedLevelName == "Tela_Fases")
                {
                    if (refScriptStatus == null)
                    {
                        refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent <Status>();
                    }

                    refScriptStatus.ultimoBotaoSelID  = -1;
                    refScriptStatus.refUltimoBotaoSel = null;
                }

                Application.LoadLevel("Tela_Tutorial");
            }
        }
        //if (OT.Clicked(this.gameObject, 0) || OT.Touched(this.gameObject))
        //{ // Verifica se colidiu com mouse ou touch;

        //    if (Application.loadedLevelName == "Tela_Fases")
        //    {
        //        Status refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent<Status>();
        //        refScriptStatus.ultimoBotaoSelID = -1;
        //        refScriptStatus.refUltimoBotaoSel = null;
        //    }

        //    Application.LoadLevel("Tela_Tutorial");
        //}



//		if(OT.Over(this.gameObject)){// Hover (pairando sobre);
//			Debug.Log("Sobre o botao!");//...
//		} else{
//			Debug.Log("Fora do botao!");
//		}
    }
Exemplo n.º 10
0
    // Update is called once per frame
    void Update()
    {
        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (this.renderer.enabled)//Se o botao estiver visivel, dai faz a checagem, caso contrario vai ficar tocando raycast quando o jogador tocar na tela para mover o carro
            {
                if (Input.touchCount >= 1)
                {
                    foreach (Touch touch in Input.touches)
                    {
                        if (touch.phase == TouchPhase.Began)
                        {
                            Ray        ray = camera1.ScreenPointToRay(touch.position);
                            RaycastHit hit;

                            if (Physics.Raycast(ray, out hit))
                            {
                                switch (hit.collider.name)
                                {
                                case "ButtonPReiniciar":
                                {
                                    this.desenhaLoading = true;
                                    if (script)
                                    {
                                        if (script.pausedGame)
                                        {
                                            script.PauseResumeGame(true);
                                        }
                                    }
                                    //			// Resumir sons:
                                    //			AudioListener.pause = false;
                                    Application.LoadLevel(Application.loadedLevel);
                                }
                                break;
                                }
                                //hit.transform.SendMessage("Clicked");
                            }
                        }
                    }
                }
            }
        }
        else//PC
        {
            if (OT.Clicked(this.gameObject))
            {
                this.desenhaLoading = true;
                if (script)
                {
                    if (script.pausedGame)
                    {
                        script.PauseResumeGame(true);
                    }
                }
                //			// Resumir sons:
                //			AudioListener.pause = false;
                Application.LoadLevel(Application.loadedLevel);
            }
        }
    }
Exemplo n.º 11
0
    // Update is called once per frame
    void Update()
    {
        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (this.renderer.enabled)//Se o botao estiver visivel, dai faz a checagem, caso contrario vai ficar tocando raycast quando o jogador tocar na tela para mover o carro
            {
                if (Input.touchCount >= 1)
                {
                    foreach (Touch touch in Input.touches)
                    {
                        if (touch.phase == TouchPhase.Began)
                        {
                            Ray        ray = camera1.ScreenPointToRay(touch.position);
                            RaycastHit hit;

                            if (Physics.Raycast(ray, out hit))
                            {
                                switch (hit.collider.name)
                                {
                                case "ButtonBack":
                                {
                                    if (Application.loadedLevelName == "Jogo")         //Testar se ta no jogo para...
                                    {
                                        GameObject.Destroy(GameObject.Find("Musica")); // ...parar a musica
                                    }

                                    if (script)
                                    {
                                        if (script.pausedGame)
                                        {
                                            script.PauseResumeGame(true);
                                        }
                                    }
                                    //			// Resumir sons:
                                    //			AudioListener.pause = false;
                                    Application.LoadLevel("Tela_Principal");
                                }
                                break;

                                case "ButtonPMenuPrincipal":
                                {
                                    if (Application.loadedLevelName == "Jogo")         //Testar se ta no jogo para...
                                    {
                                        GameObject.Destroy(GameObject.Find("Musica")); // ...parar a musica
                                    }

                                    if (script)
                                    {
                                        if (script.pausedGame)
                                        {
                                            script.PauseResumeGame(true);
                                        }
                                    }
                                    //			// Resumir sons:
                                    //			AudioListener.pause = false;
                                    Application.LoadLevel("Tela_Principal");
                                }
                                break;
                                }
                                //hit.transform.SendMessage("Clicked");
                            }
                        }
                    }
                }
            }
        }    //fim de android ou ios
        else //PC
        {
            if (OT.Clicked(this.gameObject, 0))
            {                                                      // Verifica se colidiu com mouse ou touch;
                // Teste para quando despausar o jogo;
                if (Application.loadedLevelName == "Jogo")         //Testar se ta no jogo para...
                {
                    GameObject.Destroy(GameObject.Find("Musica")); // ...parar a musica
                }
                if (script)
                {
                    if (script.pausedGame)
                    {
                        script.PauseResumeGame(true);
                    }
                }
                //			// Resumir sons:
                //			AudioListener.pause = false;
                Application.LoadLevel("Tela_Principal");
            }
        }
    }
Exemplo n.º 12
0
    // Update is called once per frame
    void Update()
    {
        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (Input.touchCount >= 1)
            {
                foreach (Touch touch in Input.touches)
                {
                    if (touch.phase == TouchPhase.Began)
                    {
                        Ray        ray = camera1.ScreenPointToRay(touch.position);
                        RaycastHit hit;

                        if (Physics.Raycast(ray, out hit))
                        {
                            switch (hit.collider.name)
                            {
                            case "ButtonPlay":
                            {
                                if (refScriptStatus == null)
                                {
                                    refScriptStatus = GameObject.Find("Status").GetComponent <Status>();
                                }

                                ////Debug.Log (s.IDFase); Debug.Break ();
                                //GameObject obj2 = GameObject.Find(("ButtonLevel-" + scriptStatus.IDFase));

                                //Btn_Fase s2 = obj2.GetComponent<Btn_Fase>();

                                //			if(s2.tempo > .0f)
                                //				s.tempoFase = s2.tempo;
                                //			else
                                //				s.tempoFase = -1f; // Indica que não exite este tempo, corrida nunca foi executada;

                                //Quando aperta o botao de play
                                if (refScriptStatus.IDFase >= 1 &&
                                    refScriptStatus.IDFase <= 6)
                                {
                                    refScriptStatus.ultimoBotaoSelID  = -1;
                                    refScriptStatus.refUltimoBotaoSel = null;
                                    refScriptStatus.IDPersonagem      = 0;   //define o personagem como o 0 - dai nao buga entre recomeços de jogo

                                    Application.LoadLevel("Tela_Escolha");
                                }
                            }
                            break;
                            }
                            //hit.transform.SendMessage("Clicked");
                        }
                    }
                }
            }
        }
        else//PC
        {
            if (OT.Clicked(this.gameObject, 0))
            { // Verifica se colidiu com mouse ou touch;
                if (refScriptStatus == null)
                {
                    refScriptStatus = GameObject.Find("Status").GetComponent <Status>();
                }

                ////Debug.Log (s.IDFase); Debug.Break ();
                //GameObject obj2 = GameObject.Find(("ButtonLevel-" + scriptStatus.IDFase));

                //Btn_Fase s2 = obj2.GetComponent<Btn_Fase>();

                //			if(s2.tempo > .0f)
                //				s.tempoFase = s2.tempo;
                //			else
                //				s.tempoFase = -1f; // Indica que não exite este tempo, corrida nunca foi executada;

                //Quando aperta o botao de play
                if (refScriptStatus.IDFase >= 1 &&
                    refScriptStatus.IDFase <= 6)
                {
                    refScriptStatus.ultimoBotaoSelID  = -1;
                    refScriptStatus.refUltimoBotaoSel = null;
                    refScriptStatus.IDPersonagem      = 0;//define o personagem como o 0 - dai nao buga entre recomeços de jogo
                    Application.LoadLevel("Tela_Escolha");
                }
            }
        }
    }
Exemplo n.º 13
0
    // Update is called once per frame
    void Update()
    {
        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (this.renderer.enabled)//Se o botao estiver visivel, dai faz a checagem, caso contrario vai ficar tocando raycast quando o jogador tocar na tela para mover o carro
            {
                if (Input.touchCount >= 1)
                {
                    foreach (Touch touch in Input.touches)
                    {
                        if (touch.phase == TouchPhase.Began)
                        {
                            Ray        ray = camera1.ScreenPointToRay(touch.position);
                            RaycastHit hit;

                            if (Physics.Raycast(ray, out hit))
                            {
                                switch (hit.collider.tag)
                                {
                                case "PRedBtnM":                                       //Pressionou o Botao menu
                                {
                                    if (Application.loadedLevelName == "Jogo")         //Testar se ta no jogo para...
                                    {
                                        GameObject.Destroy(GameObject.Find("Musica")); // ...parar a musica do jogo
                                    }

                                    if (refScriptStatus == null)
                                    {
                                        refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent <Status>();
                                    }

                                    refScriptStatus.SetSelecionarBotaoFase();

                                    ScriptObjGerenciador refScriptGerente = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScriptObjGerenciador>();
                                    refScriptGerente.PauseResumeGame(true);

                                    Application.LoadLevel("Tela_Fases");
                                }
                                break;

                                case "PRedBtnR":    //Reinicia a fase
                                {
                                    ScriptObjGerenciador refScriptGerente = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScriptObjGerenciador>();
                                    refScriptGerente.PauseResumeGame(true);

                                    Application.LoadLevel(Application.loadedLevel);
                                }
                                break;
                                }
                            }
                        }
                    }
                }
            }
        }
        else //PC
        {
            if (OT.Clicked(this.gameObject, 0))
            {
                if (this.tag == "PRedBtnM")                            //Pressionou o Botao menu
                {
                    if (Application.loadedLevelName == "Jogo")         //Testar se ta no jogo para...
                    {
                        GameObject.Destroy(GameObject.Find("Musica")); // ...parar a musica do jogo
                    }

                    if (refScriptStatus == null)
                    {
                        refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent <Status>();
                    }

                    refScriptStatus.SetSelecionarBotaoFase();

                    ScriptObjGerenciador refScriptGerente = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScriptObjGerenciador>();
                    refScriptGerente.PauseResumeGame(true);

                    Application.LoadLevel("Tela_Fases");
                }
                else if (this.tag == "PRedBtnR")//Reinicia a fase
                {
                    ScriptObjGerenciador refScriptGerente = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScriptObjGerenciador>();
                    refScriptGerente.PauseResumeGame(true);


                    Application.LoadLevel(Application.loadedLevel);
                }
            }
        }
    }
Exemplo n.º 14
0
    // Update is called once per frame
    void Update()
    {
        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (this.renderer.enabled)//Se o botao estiver visivel, dai faz a checagem, caso contrario vai ficar tocando raycast quando o jogador tocar na tela para mover o carro
            {
                if (Input.touchCount >= 1)
                {
                    foreach (Touch touch in Input.touches)
                    {
                        if (touch.phase == TouchPhase.Began)
                        {
                            Ray        ray = camera1.ScreenPointToRay(touch.position);
                            RaycastHit hit;

                            if (Physics.Raycast(ray, out hit))
                            {
                                // Menu de pausa e pausar o jogo:
                                GameObject[] objetos;

                                switch (hit.collider.name)
                                {
                                case "ButtonPause":
                                {
                                    if (this.scriptRef.pausedGame)            //se o jogo tiver pausado -- quando aperta o voltar
                                    {
                                        new WaitForSeconds(1);                // Subroutine;

                                        this.scriptRef.PauseResumeGame(true); //this.scriptRef.btnPausePressed = !this.scriptRef.btnPausePressed;// Pausar jogo;
                                        // Resumir sons:
                                        AudioListener.pause = false;

                                        GameObject.Find("FundoTelaPause").gameObject.GetComponent <MeshRenderer>().enabled = false;

                                        GameObject btnPause = GameObject.Find("ButtonPause").gameObject;

                                        btnPause.GetComponent <MeshRenderer>().enabled = true;
                                        btnPause.GetComponent <BoxCollider>().enabled  = true;

                                        objetos = GameObject.FindGameObjectsWithTag("pauseMenu");

                                        foreach (GameObject element in objetos)
                                        {
                                            element.gameObject.GetComponent <MeshRenderer>().enabled = false;       //element.gameObject.SetActive(false);
                                            element.gameObject.GetComponent <BoxCollider>().enabled  = false;
                                        }
                                    }
                                    else
                                    {
                                        this.scriptRef.PauseResumeGame(false);
                                        // Parar sons:
                                        AudioListener.pause = true;

                                        GameObject.Find("FundoTelaPause").gameObject.GetComponent <MeshRenderer>().enabled = true;
                                        //this.gameObject.SetActive(false); // Desativa este objeto;

                                        GameObject btnPause = GameObject.Find("ButtonPause").gameObject;

                                        btnPause.GetComponent <MeshRenderer>().enabled = false;
                                        btnPause.GetComponent <BoxCollider>().enabled  = false;

                                        // Ativa os botoes e o fundo:
                                        //try{
                                        objetos = GameObject.FindGameObjectsWithTag("pauseMenu");
                                        foreach (GameObject element in objetos)
                                        {
                                            element.gameObject.GetComponent <MeshRenderer>().enabled = true;
                                            element.gameObject.GetComponent <BoxCollider>().enabled  = true;
                                        }
                                    }

                                    break;
                                }        //fim do case

                                case "ButtonPVoltar":
                                {
                                    if (this.scriptRef.pausedGame)            //se o jogo tiver pausado -- quando aperta o voltar
                                    {
                                        new WaitForSeconds(1);                // Subroutine;

                                        this.scriptRef.PauseResumeGame(true); //this.scriptRef.btnPausePressed = !this.scriptRef.btnPausePressed;// Pausar jogo;
                                        // Resumir sons:
                                        AudioListener.pause = false;

                                        GameObject.Find("FundoTelaPause").gameObject.GetComponent <MeshRenderer>().enabled = false;

                                        GameObject btnPause = GameObject.Find("ButtonPause").gameObject;

                                        btnPause.GetComponent <MeshRenderer>().enabled = true;
                                        btnPause.GetComponent <BoxCollider>().enabled  = true;

                                        objetos = GameObject.FindGameObjectsWithTag("pauseMenu");

                                        foreach (GameObject element in objetos)
                                        {
                                            element.gameObject.GetComponent <MeshRenderer>().enabled = false;       //element.gameObject.SetActive(false);
                                            element.gameObject.GetComponent <BoxCollider>().enabled  = false;
                                        }
                                    }
                                    else
                                    {
                                        this.scriptRef.PauseResumeGame(false);
                                        // Parar sons:
                                        AudioListener.pause = true;

                                        GameObject.Find("FundoTelaPause").gameObject.GetComponent <MeshRenderer>().enabled = true;
                                        //this.gameObject.SetActive(false); // Desativa este objeto;

                                        GameObject btnPause = GameObject.Find("ButtonPause").gameObject;

                                        btnPause.GetComponent <MeshRenderer>().enabled = false;
                                        btnPause.GetComponent <BoxCollider>().enabled  = false;

                                        // Ativa os botoes e o fundo:
                                        //try{
                                        objetos = GameObject.FindGameObjectsWithTag("pauseMenu");
                                        foreach (GameObject element in objetos)
                                        {
                                            element.gameObject.GetComponent <MeshRenderer>().enabled = true;
                                            element.gameObject.GetComponent <BoxCollider>().enabled  = true;
                                        }
                                    }
                                    break;
                                }
                                }
                            }
                        }
                    }
                }
            }
        }
        else//PC
        {
            if (OT.Clicked(this.gameObject))
            {
                // Menu de pausa e pausar o jogo:
                GameObject[] objetos;
                if (this.scriptRef.pausedGame)
                {
                    new WaitForSeconds(1);                // Subroutine;

                    this.scriptRef.PauseResumeGame(true); //this.scriptRef.btnPausePressed = !this.scriptRef.btnPausePressed;// Pausar jogo;
                    // Resumir sons:
                    AudioListener.pause = false;

                    GameObject.Find("FundoTelaPause").gameObject.GetComponent <MeshRenderer>().enabled = false;
                    //try{
                    //GameObject.Find("ButtonPause").gameObject.SetActive(true);
                    //GameObject.FindGameObjectWithTag("botaoPausaInGame").gameObject.SetActive(true);
                    //GameObject objPausa = GameObject.Find("ButtonPause");
                    //objPausa.gameObject.SetActive(true);
                    //} catch{Debug.LogError("Nope");}
                    GameObject.Find("ButtonPause").gameObject.GetComponent <MeshRenderer>().enabled = true;
                    GameObject.Find("ButtonPause").gameObject.GetComponent <BoxCollider>().enabled  = true;

                    objetos = GameObject.FindGameObjectsWithTag("pauseMenu");
                    foreach (GameObject element in objetos)
                    {
                        element.gameObject.GetComponent <MeshRenderer>().enabled = false;//element.gameObject.SetActive(false);
                        element.gameObject.GetComponent <BoxCollider>().enabled  = false;
                    }
                }
                else
                {
                    this.scriptRef.PauseResumeGame(false);
                    // Parar sons:
                    AudioListener.pause = true;

                    GameObject.Find("FundoTelaPause").gameObject.GetComponent <MeshRenderer>().enabled = true;
                    //this.gameObject.SetActive(false); // Desativa este objeto;
                    GameObject.Find("ButtonPause").gameObject.GetComponent <MeshRenderer>().enabled = false;
                    GameObject.Find("ButtonPause").gameObject.GetComponent <BoxCollider>().enabled  = false;

                    // Ativa os botoes e o fundo:
                    //try{
                    objetos = GameObject.FindGameObjectsWithTag("pauseMenu");
                    foreach (GameObject element in objetos)
                    {
                        element.gameObject.GetComponent <MeshRenderer>().enabled = true;
                        element.gameObject.GetComponent <BoxCollider>().enabled  = true;
                    }
                    //				for(int i=0; i<objetos.Length; i++){
                    ////					Debug.Log (i);
                    ////					Debug.Break();
                    //					objetos[i].gameObject.SetActive(true);
                    //				}
                    //} catch{Debug.LogError ("Falhou");}
                }
            }
        }
    }//fim update
Exemplo n.º 15
0
    // Update is called once per frame
    void Update()
    {
        //if (Input.touchCount >= 1)
        //{
        //    foreach (Touch touch in Input.touches)
        //    {
        //        if (touch.phase == TouchPhase.Began)
        //        {
        //            Ray ray = camera1.ScreenPointToRay(touch.position);
        //            RaycastHit hit;

        //            if (Physics.Raycast(ray, out hit))
        //            {
        //                switch (hit.collider.tag)
        //                {
        //                    case "Btn":
        //                        {
        //                            // Se nao estiver bloqueado:
        //                            if (!this.bloqueado)
        //                            {
        //                                //refScriptStatus.SetOldFase(refScriptStatus.IDFase);
        //                                //SelecionarBotao();

        //                                if (refScriptStatus == null)
        //                                {
        //                                    refScriptStatus = GameObject.Find("Status").GetComponent<Status>();
        //                                }

        //                                refScriptStatus.IDFase = this.ID;
        //                                refScriptStatus.SelecionarBotaoFaseDentroStatus();

        //                                //refScriptStatus.SetTempoJogobasedOnFase();

        //                                ////atualiza os melhores tempos
        //                                //if (refMelhoresTempos == null)
        //                                //{
        //                                //    refMelhoresTempos = GameObject.Find("MelhoresTempos").GetComponent<MelhoresTempos>();
        //                                //}

        //                                //refMelhoresTempos.TrocouFaseSelecionada();

        //                            }
        //                            break;
        //                        }
        //                 }

        //            }
        //        }
        //    }
        //}

        if (!refScriptStatus.isAndroid &&
            !refScriptStatus.isiOS)   //se nao for nenhum dos 2
        {
            if (OT.Clicked(this.gameObject, 0))
            {
                // Se nao estiver bloqueado:
                if (!this.bloqueado)
                {
                    if (refScriptStatus == null)
                    {
                        refScriptStatus = GameObject.Find("Status").GetComponent <Status>();
                    }

                    refScriptStatus.IDFase = this.ID;
                    refScriptStatus.SelecionarBotaoFaseDentroStatus();
                }
            }
        }


//        if(OT.Clicked(this.gameObject, 0) || OT.Touched(this.gameObject))
//        { // Verifica se colidiu com mouse ou touch;
//            //Debug.Log("Clicou no botao para entrar em uma fase");
//            //Application.LoadLevel("Tela_Jogo");
//// Aqui iria o codigo que confere qual e a fase e entra no jogo no ponto inicial especifico.
//#if v2

//            // Se nao estiver bloqueado:
//            if(!this.bloqueado)
//            {

//                //refScriptStatus.SetOldFase(refScriptStatus.IDFase);

//                //SelecionarBotao();

//                if (refScriptStatus == null)
//                {
//                    refScriptStatus = GameObject.Find("Status").GetComponent<Status>();
//                }

//                refScriptStatus.IDFase = this.ID;
//                refScriptStatus.SelecionarBotaoFaseDentroStatus();

//                //refScriptStatus.SetTempoJogobasedOnFase();

//                ////atualiza os melhores tempos
//                //if (refMelhoresTempos == null)
//                //{
//                //    refMelhoresTempos = GameObject.Find("MelhoresTempos").GetComponent<MelhoresTempos>();
//                //}

//                //refMelhoresTempos.TrocouFaseSelecionada();

//            }

//#endif
//        }
    }
Exemplo n.º 16
0
    // Update is called once per frame
    void Update()
    {
        if (refScriptStatus.isAndroid ||
            refScriptStatus.isiOS)
        {
            if (Input.touchCount >= 1)
            {
                foreach (Touch touch in Input.touches)
                {
                    if (touch.phase == TouchPhase.Began)
                    {
                        Ray        ray = camera1.ScreenPointToRay(touch.position);
                        RaycastHit hit;

                        if (Physics.Raycast(ray, out hit))
                        {
                            switch (hit.collider.name)
                            {
                            case "ButtonPlay":
                            {
                                GameObject.Destroy(GameObject.Find("MusicaMenu"));         // Para a musica do Menu
                                GameObject            obj = GameObject.Find("Fundo");
                                ControladorBackground s   = obj.GetComponent <ControladorBackground>();

                                try
                                {
                                    GameObject obj2 = GameObject.Find("Status");
                                    Status     s2   = obj2.GetComponent <Status>();
                                    s2.IDPersonagem = s.ID;

                                    this.desenhaLoading = true;

                                    switch (s2.IDFase)                                                   //Carrega fase
                                    {
                                    case 1:
                                        Application.LoadLevel("Fase1");
                                        break;

                                    case 2:
                                        Application.LoadLevel("Fase2");
                                        break;

                                    case 3:
                                        Application.LoadLevel("Fase3");
                                        break;

                                    case 4:
                                        Application.LoadLevel("Fase4");
                                        break;

                                    case 5:
                                        Application.LoadLevel("Fase5");
                                        break;

                                    case 6:
                                        Application.LoadLevel("Fase6");
                                        break;
                                    }
                                }
                                catch
                                {
                                    Debug.LogError("Status não criado!; Btn5.cs");
                                }



                                //Application.LoadLevel("Jogo"); // CARREGAR A CENA DO JOGO!
                            }
                            break;
                            }
                        }
                    }
                }
            }
        }
        else//PC
        {
            if (OT.Clicked(this.gameObject, 0))
            { // Verifica se colidiu com mouse ou touch;
              //Application.LoadLevel("Jogo"); // CARREGAR A CENA DO JOGO!

                GameObject.Destroy(GameObject.Find("MusicaMenu")); // Para a musica do Menu

                GameObject            obj = GameObject.Find("Fundo");
                ControladorBackground s   = obj.GetComponent <ControladorBackground>();
                try
                {
                    GameObject obj2 = GameObject.Find("Status");
                    Status     s2   = obj2.GetComponent <Status>();
                    s2.IDPersonagem = s.ID;

                    this.desenhaLoading = true;

                    switch (s2.IDFase)//Carrega fase
                    {
                    case 1:
                        Application.LoadLevel("Fase1");
                        break;

                    case 2:
                        Application.LoadLevel("Fase2");
                        break;

                    case 3:
                        Application.LoadLevel("Fase3");
                        break;

                    case 4:
                        Application.LoadLevel("Fase4");
                        break;

                    case 5:
                        Application.LoadLevel("Fase5");
                        break;

                    case 6:
                        Application.LoadLevel("Fase6");
                        break;
                    }
                }
                catch
                {
                    Debug.LogError("Status não criado!; Btn5.cs");
                }

                //Application.LoadLevel("Jogo"); // CARREGAR A CENA DO JOGO!
            }
        }
    }
Exemplo n.º 17
0
    // Update is called once per frame
    void Update()
    {
        // only go on if Orthello is ready
        if (!OT.isValid)
        {
            return;
        }
        // Initialize application once
        if (!initialized)
        {
            Initialize();
        }

        // if containers that were created are not ready yet, lets hold.
        if (!OT.ContainersReady())
        {
            return;
        }

        switch (appMode)
        {
        case 1:
            star.visible = true;
            // we are in the star stage so increase star creation wait time
            starTime += Time.deltaTime;
            // check if we may create a new star
            if (starTime > starSpeed)
            {
                // Lets create one, reset the wait time
                starTime = 0;
                // Create a copy of out animating star
                OTAnimatingSprite newStar = OT.CreateSprite(star) as OTAnimatingSprite;
                // Put this star in our active stars list
                stars.Add(newStar);
                // Give it a random size
                newStar.size *= (0.3f + Random.value * 2.5f);
                // Give it a random position on the right border of the screen
                newStar.position = new Vector2((Screen.width / 2) + newStar.size.x / 2,
                                               ((Screen.height / 2) * -1) + newStar.size.y / 2 + Random.value * (Screen.height - newStar.size.y));
                // Calculate the depth (smaller stars to the back, bigger to the front)
                newStar.depth = (int)((1 / newStar.size.x) * 100);
                // Set material to additive
                newStar.additive   = true;
                newStar.frameIndex = 0;
            }

            // Lets loop all active stars
            // HINT : Because we will be adjusting (removing) items as they get out of view,
            // we better not use a for() loop. While() is the better way for this.
            int s = 0;
            while (s < stars.Count)
            {
                // get next active star
                OTAnimatingSprite dStar = stars[s];
                // increase its position
                dStar.position += new Vector2(stars[s].size.x * 3 * Time.deltaTime * -1, 0);
                // If the star gets out of view we will remove and destroy it
                if (dStar.outOfView)
                {
                    // remove from active stars list
                    stars.Remove(dStar);
                    // destroy this object
                    OT.DestroyObject(dStar);
                    // no need to increment iterator as we just removed the current element
                }
                else
                {
                    s++;     // increment iterator
                }
            }
            break;

        case 2:
            man.visible = true;
            // we are in the walking man stage so calculate a normalized vector from
            // our man to the mouse pointer
            Vector2 mouseVector = (OT.view.mouseWorldPosition - man.position).normalized;
            // The Atan2 will give you a -3.141 to 3.141 range depending of your vector x/y values
            float angle = Mathf.Atan2(mouseVector.x, mouseVector.y);
            // Play the right frameset dependent on the angle
            float  part = 6.2f / 8;
            string anim = "";
            if (angle > -1 * (part / 2) && angle <= (part / 2))
            {
                anim = "up";
            }
            else
            if (angle > -3 * (part / 2) && angle <= -1 * (part / 2))
            {
                anim = "upLeft";
            }
            else
            if (angle > -5 * (part / 2) && angle <= -3 * (part / 2))
            {
                anim = "left";
            }
            else
            if (angle > -7 * (part / 2) && angle <= -5 * (part / 2))
            {
                anim = "downLeft";
            }
            else
            if (angle > (part / 2) && angle <= 3 * (part / 2))
            {
                anim = "upRight";
            }
            else
            if (angle > 3 * (part / 2) && angle <= 5 * (part / 2))
            {
                anim = "right";
            }
            else
            if (angle > 5 * (part / 2) && angle <= 7 * (part / 2))
            {
                anim = "downRight";
            }
            else
            {
                anim = "down";
            }
            man.PlayLoop(anim);
            // adjust background scroll speed related to our mouse vector
            back.scrollSpeed = mouseVector * 10;
            break;
        }

        // color menu red when we are hovering over an item
        if (OT.Over(stage1))
        {
            stagemesh1.renderer.material.color = new Color(1, .3f, .3f);
        }
        else
        {
            stagemesh1.renderer.material.color = new Color(1, 1, 1);
        }

        if (OT.Over(stage2))
        {
            stagemesh2.renderer.material.color = new Color(1, .3f, .3f);
        }
        else
        {
            stagemesh2.renderer.material.color = new Color(1, 1, 1);
        }


        //check if we want to change stage
        if (OT.Clicked(stage1))
        {
            appMode = 1;
            CreateObjects();
        }
        else
        if (OT.Clicked(stage2))
        {
            appMode = 2;
            CreateObjects();
        }
    }
Exemplo n.º 18
0
    // Update is called once per frame
    void Update()
    {
        if (!refScriptStatus.carregando())
        {
            this.renderer.enabled = true;

            if (refScriptStatus.isAndroid ||
                refScriptStatus.isiOS)
            {
                if (Input.touchCount >= 1)
                {
                    foreach (Touch touch in Input.touches)
                    {
                        if (touch.phase == TouchPhase.Began)
                        {
                            Ray        ray = camera1.ScreenPointToRay(touch.position);
                            RaycastHit hit;

                            if (Physics.Raycast(ray, out hit))
                            {
                                switch (hit.collider.name)
                                {
                                case "ButtonPlay":
                                {
                                    //refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent<Status>();

                                    refScriptStatus.SetSelecionarBotaoFase();

                                    Application.LoadLevel("Tela_Fases");
                                }
                                break;

                                case "ButtonBack":
                                {
                                    //refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent<Status>();
                                    refScriptStatus.SetSelecionarBotaoFase();

                                    Application.LoadLevel("Tela_Fases");
                                }
                                break;
                                }
                                //hit.transform.SendMessage("Clicked");
                            }
                        }
                    }
                }
            }
            else//PC
            {
                if (OT.Clicked(this.gameObject, 0))
                { // Verifica se colidiu com mouse ou touch;
                    //botao proximo, que leva a seleção de fase, e tambem o botao que volta
                    if (refScriptStatus == null)
                    {
                        refScriptStatus = GameObject.FindGameObjectWithTag("Status").GetComponent <Status>();
                    }

                    refScriptStatus.SetSelecionarBotaoFase();

                    Application.LoadLevel("Tela_Fases");
                }
            }
        }
        else
        {
            this.renderer.enabled = false;
        }
    }