示例#1
0
 public void ManageInventory(GameObject clicked)
 {
     //Inventoriado de Objetos - START
     clickedobject = clicked.GetComponent <Clicked> ();
     try {
         if (!IsInInventory(clicked.name))
         {
             if (clickedobject.visible)
             {
                 GameObject Inventario = GameObject.Find("Inventario");
                 Inven      codigo     = Inventario.GetComponent <Inven> ();
                 codigo.AddGO(clickedobject.sprite);
                 //this.gameObject.GetComponent<Renderer> ().enabled = false;
                 clicked.gameObject.SetActive(false);
                 GameObject global = GameObject.Find("ScriptGlobal");
                 Global     sglob  = global.GetComponent <Global> ();
                 sglob.objetoarr(clicked.name);
                 clickedobject.visible = false;
             }
             if (clickedobject.sg.Orbit)
             {
                 clickedobject.isDragging = true;
             }
         }
     } catch {
         Debug.Log("0035");
     }
     //Inventoriado de Objetos - END
 }
示例#2
0
文件: Global.cs 项目: ezecoen/Within
    public void Resolve(string nomm)
    {
        if (Orbit)
        {
            GameObject objeto = DevolverGO(nomm);
            Debug.Log(nomm + "0043");
            Debug.Log(objeto.name + "2111");
            if (nowOrbitingName != "")
            {
                GameObjectFinder(nowOrbitingName).SetActive(false);
            }
            nowOrbitingName = "";
            nowOrbitingName = objeto.name;
            objeto.gameObject.SetActive(true);
            GameObject cam    = GameObject.Find("CamaraOrbit");
            Camera     camara = cam.GetComponent <Camera> ();
            camara.GetComponent <Camera> ().depth = 5;
            GameObject o = GameObject.Find("Orbiting");
            Debug.Log(objeto.transform.position.ToString());
            Debug.Log(o.transform.position.ToString());
            objeto.transform.position = o.transform.position;
            //objeto.GetComponent<Renderer>().enabled=true;
            Debug.Log(objeto.gameObject.transform.position.ToString() + "2058");
            Messenger.Message("Haz click derecho " + "\n" + "para salir", 0.01f, Color.yellow, true, false);
        }
        if (Combinar)
        {
            if (contarobj == 1)
            {
                GameObject bot    = GameObject.Find(nomm);
                NumInt     numint = bot.GetComponent <NumInt>();
                int        nume   = numint.numarray;
                //bot = GameObject.Find(Combinado);
                bot    = GameObjectFinder(Combinado);
                numint = bot.GetComponent <NumInt>();
                int    nume2       = numint.numarray;
                string nuevoobjeto = Unite(Inventario[nume2], Inventario[nume]);
                if (nuevoobjeto != "")
                {
                    //borro imagen, deshabilito botones
                    Inventario[nume]  = "";
                    Inventario[nume2] = "";
                    //GameObject Inventario2 = GameObject.Find (Combinado);
                    GameObject            Inventario2 = GameObjectFinder(Combinado);
                    UnityEngine.UI.Button btn         = Inventario2.GetComponent <UnityEngine.UI.Button> ();
                    btn.interactable = false;
                    btn.image.sprite = default(Sprite);
                    //Inventario2 = GameObject.Find (nomm);
                    Inventario2      = GameObjectFinder(nomm);
                    btn              = Inventario2.GetComponent <UnityEngine.UI.Button> ();
                    btn.interactable = false;
                    btn.image.sprite = default(Sprite);
                    Selected         = "";
                    //pego
                    //GameObject objeton = GameObject.Find(nuevoobjeto);
                    GameObject objeton = GameObjectFinder(nuevoobjeto);
                    //GameObject Inventario1 = GameObject.Find("Inventario");
                    GameObject Inventario1 = GameObjectFinder("Inventario");
                    Clicked    getspr      = objeton.GetComponent <Clicked>();
                    Inven      codigo      = Inventario1.GetComponent <Inven> ();
                    Sprite     sprite      = getspr.sprite;
                    objetoarr(nuevoobjeto);
                    codigo.AddGO(sprite);

                    getspr.visible = false;
                    contarobj      = 0;
                    Combinado      = "";
                    Combinar       = false;
                }
                else
                {
                    Combinar  = false;
                    Combinado = "";
                    contarobj = 0;
                }
            }
            else
            {
                contarobj++;
                Combinado = nomm;
            }
        }
    }
示例#3
0
 void SingleClick()
 {
     try {
         if (gl.GameObjectFinder("Vela prendida").activeSelf == true)
         {
             gl.GameObjectFinder("Vela prendida").GetComponent <Animator> ().SetBool("openNow", true);
             //Esconder dsp de animacion
         }
     } catch {
     }
     try {
         if (gl.GameObjectFinder("Llave").activeSelf == true)
         {
             gl.GameObjectFinder("Llave").GetComponent <Animator> ().SetBool("openNow", true);
             //Esconder dsp de animacion
         }
     } catch {
     }
     // Salir al menu
     if (Input.GetKey(KeyCode.Escape))
     {
         Application.LoadLevel("Menu");
     }
     //Single clicking
     if (doubleClickStart != -1 && Time.time - doubleClickStart > 0.5f && doubleClickHelper)
     {
         //Single click code HERE!
         //COEN - START!!!
         if (this.tag == "Animated" || this.tag == "caja partes")
         {
             Debug.Log("unityyyyiaiuyfiuafuayf");
             if (this.name == "Tapa( la que sirve)")                   //esto tambien
             {
                 this.GetComponent <MeshCollider> ().enabled = false;
                 this.transform.transform.transform.transform.transform.transform.transform.transform.parent.gameObject.transform.transform.transform.GetChild(0).GetComponent <MeshCollider> ().enabled = true;
             }
             RunAnimation(boolName, animator);
         }
         else
         {
             //Inventoriado de Objetos - START
             clickedobject = this.GetComponent <Clicked> ();
             try {
                 if (!IsInInventory(this.name))
                 {
                     if (clickedobject.visible)
                     {
                         GameObject Inventario = GameObject.Find("Inventario");
                         Inven      codigo     = Inventario.GetComponent <Inven> ();
                         codigo.AddGO(this.clickedobject.sprite);
                         //this.gameObject.GetComponent<Renderer> ().enabled = false;
                         this.gameObject.SetActive(false);
                         GameObject global = GameObject.Find("ScriptGlobal");
                         Global     sglob  = global.GetComponent <Global> ();
                         sglob.objetoarr(this.name);
                         clickedobject.visible = false;
                     }
                     if (clickedobject.sg.Orbit)
                     {
                         clickedobject.isDragging = true;
                     }
                 }
             } catch {
                 Debug.Log("0035");
             }
             //Inventoriado de Objetos - END
         }
         doubleClickStart = -1;
         Debug.Log("Single click!");
     }
 }