Advertisement
Guest User

PasZ full code, paste by Berenger

a guest
May 3rd, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.05 KB | None | 0 0
  1. public IEnumerator Delay () {
  2.         Debug.Log("Funcion delay");
  3.     yield return new WaitForSeconds(0.1f);
  4.     }
  5.    
  6.     void Update () {
  7.         foreach (Touch touch in Input.touches)
  8.         {
  9.             Ray ray = Camera.main.ScreenPointToRay(touch.position);
  10.            
  11.             if (touch.phase == TouchPhase.Began)
  12.             {
  13.                 RaycastHit hit = new RaycastHit();
  14.                 if (Physics.Raycast(ray, out hit, 1000))
  15.                 {
  16.                     switch(hit.transform.name)
  17.                     {
  18.                         case "recetas":
  19.                         {
  20.                             Debug.Log("boton recetas");
  21.                             GameObject.Find("menu2").renderer.enabled = false;
  22.                             Debug.Log("Oculta menu");      
  23.                             GameObject animacion = GameObject.Find("RULETA");
  24.                             activarAnimacion(animacion);
  25.                            
  26.                             desactivarAnimacion(animacion);
  27.                             Debug.Log("Desactiva anim");
  28.                             GameObject.Find("menu2").renderer.enabled = true;
  29.                             Debug.Log("Muestra menu");
  30.                         //CAMBIAAAAAAAAAAAAAAAAAAAR!                                                                                                                                                                                  
  31.                         //CAMBIAAAAAAAAAAAAAAAAAAAR!
  32.                         /*  Renderer receta1 = GameObject.Find("receta1").renderer;
  33.                             receta1.enabled = true;
  34.                             //modeloCasancrem = "receta1";
  35.                             //hay que desactivar los botones del menu y activar los de receta2
  36.                            
  37.                            
  38.                             Debug.Log("desactivo el boton de recetas");
  39.                             GameObject recetasCol = GameObject.Find("recetas");
  40.                             recetasCol.collider.enabled = false;
  41.                             Debug.Log("desactivo el boton de trucos");
  42.                             GameObject trucosCol = GameObject.Find("trucos");
  43.                             trucosCol.collider.enabled = false;
  44.                            
  45.                            
  46.                             Debug.Log("activo el receta1Next");
  47.                             GameObject recetas1NextCollider = GameObject.Find("receta1Next");
  48.                             recetas1NextCollider.collider.enabled = true;
  49.                             Debug.Log("activo el receta1prev");
  50.                             GameObject recetas1PrevCollider = GameObject.Find("receta1Prev");
  51.                             recetas1PrevCollider.collider.enabled = true;
  52.                        
  53.                             Debug.Log("escondo el menu");
  54.                             Renderer menuCasanCrem = GameObject.Find("menuCasanCrem").renderer;
  55.                             menuCasanCrem.enabled = false;
  56.                     */  //CAMBIAAAAAAAAAAAAAAAAAAAR!
  57.                         //CAMBIAAAAAAAAAAAAAAAAAAAR!
  58.                         break;
  59.                         }
  60.                         case "fb":
  61.                         {
  62.                             Application.OpenURL("http://www.facebook.com/casancremoficial");
  63.                             break;
  64.                         }
  65.                     }
  66.                 }
  67.             }
  68.         }
  69.     }
  70.    
  71.     void activarAnimacion(GameObject animacion){
  72.         //muestro todos los planos hijos
  73.         Renderer[] textsAnimacion = animacion.GetComponentsInChildren<Renderer>();
  74.         foreach (Renderer textura in textsAnimacion){
  75.             textura.enabled = true;
  76.         }
  77.         //activo la animacion
  78.         animacion.animation.Play();
  79.         Delay();
  80.        
  81.     }
  82. void desactivarAnimacion(GameObject animacion){
  83.         //muestro todos los planos hijos
  84.         Renderer[] textsAnimacion = animacion.GetComponentsInChildren<Renderer>();
  85.         foreach (Renderer textura in textsAnimacion){
  86.             textura.enabled = false;
  87.         }
  88.         //desactivo la animacion
  89.         animacion.animation.Stop();
  90.         Debug.Log("Desactiva anim");
  91.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement