Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public IEnumerator Delay () {
- Debug.Log("Funcion delay");
- yield return new WaitForSeconds(0.1f);
- }
- void Update () {
- foreach (Touch touch in Input.touches)
- {
- Ray ray = Camera.main.ScreenPointToRay(touch.position);
- if (touch.phase == TouchPhase.Began)
- {
- RaycastHit hit = new RaycastHit();
- if (Physics.Raycast(ray, out hit, 1000))
- {
- switch(hit.transform.name)
- {
- case "recetas":
- {
- Debug.Log("boton recetas");
- GameObject.Find("menu2").renderer.enabled = false;
- Debug.Log("Oculta menu");
- GameObject animacion = GameObject.Find("RULETA");
- activarAnimacion(animacion);
- desactivarAnimacion(animacion);
- Debug.Log("Desactiva anim");
- GameObject.Find("menu2").renderer.enabled = true;
- Debug.Log("Muestra menu");
- //CAMBIAAAAAAAAAAAAAAAAAAAR!
- //CAMBIAAAAAAAAAAAAAAAAAAAR!
- /* Renderer receta1 = GameObject.Find("receta1").renderer;
- receta1.enabled = true;
- //modeloCasancrem = "receta1";
- //hay que desactivar los botones del menu y activar los de receta2
- Debug.Log("desactivo el boton de recetas");
- GameObject recetasCol = GameObject.Find("recetas");
- recetasCol.collider.enabled = false;
- Debug.Log("desactivo el boton de trucos");
- GameObject trucosCol = GameObject.Find("trucos");
- trucosCol.collider.enabled = false;
- Debug.Log("activo el receta1Next");
- GameObject recetas1NextCollider = GameObject.Find("receta1Next");
- recetas1NextCollider.collider.enabled = true;
- Debug.Log("activo el receta1prev");
- GameObject recetas1PrevCollider = GameObject.Find("receta1Prev");
- recetas1PrevCollider.collider.enabled = true;
- Debug.Log("escondo el menu");
- Renderer menuCasanCrem = GameObject.Find("menuCasanCrem").renderer;
- menuCasanCrem.enabled = false;
- */ //CAMBIAAAAAAAAAAAAAAAAAAAR!
- //CAMBIAAAAAAAAAAAAAAAAAAAR!
- break;
- }
- case "fb":
- {
- Application.OpenURL("http://www.facebook.com/casancremoficial");
- break;
- }
- }
- }
- }
- }
- }
- void activarAnimacion(GameObject animacion){
- //muestro todos los planos hijos
- Renderer[] textsAnimacion = animacion.GetComponentsInChildren<Renderer>();
- foreach (Renderer textura in textsAnimacion){
- textura.enabled = true;
- }
- //activo la animacion
- animacion.animation.Play();
- Delay();
- }
- void desactivarAnimacion(GameObject animacion){
- //muestro todos los planos hijos
- Renderer[] textsAnimacion = animacion.GetComponentsInChildren<Renderer>();
- foreach (Renderer textura in textsAnimacion){
- textura.enabled = false;
- }
- //desactivo la animacion
- animacion.animation.Stop();
- Debug.Log("Desactiva anim");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement