Example #1
0
    public void showTextGayung()
    {
        RaycastHit detect;

        UnityEngine.Debug.Log("NamaGayung");
        if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out detect, range))
        {
            INTR_Gayung gayung = detect.transform.GetComponent <INTR_Gayung>();
            if (gayung != null)
            {
                oldGayung = gayung;
                gayung.showTextGayung();

                textGayung = true;

                infoGayung.SetBool("viewInfo", true);
                infoGayung.SetBool("closeInfo", false);
            }
            else
            {
                oldGayung.unshowTextGayung();
                textGayung = false;
                infoGayung.SetBool("viewInfo", false);
                infoGayung.SetBool("closeInfo", true);
                infoGayung.SetBool("empty", true);
            }
        }
    }
Example #2
0
    /*public void redToGreen()
     * {
     *
     *      RaycastHit detect;
     *
     *      UnityEngine.Debug.Log("red");
     *      if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out detect, range))
     *      {
     *
     *              Arrow redToGreen = detect.transform.GetComponent<Arrow>();
     *              if (redToGreen != null)
     *              {
     *                      red = redToGreen;
     *                      redToGreen.unshowRed();
     *                      redToGreen.showGreen();
     *              }
     *
     *      }
     * }
     */



    public void interactItem()
    {
        RaycastHit detect;

        UnityEngine.Debug.Log("detect");
        if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out detect, range))
        {
            //check tangan full atau tak
            //not_full == true
            if (not_full)
            {
                //code to call object script

                //sabun


                //sugi
                INTR_Sugi sugi = detect.transform.GetComponent <INTR_Sugi>();
                if (sugi != null)
                {
                    sugi.grab();
                    kanan.pegangSugi();
                    not_full = false;
                }

                //gayung
                INTR_Gayung gayung = detect.transform.GetComponent <INTR_Gayung>();

                if (gayung != null)
                {
                    gayung.grab();
                    UnityEngine.Debug.Log("dah amik gayung");
                    kanan.pegangGayung();
                    not_full = false;
                }

                //sabun
                INTR_Sabun sabun = detect.transform.GetComponent <INTR_Sabun>();
                if (sabun != null)
                {
                    sabun.grab();
                    kanan.pegangSabun();
                    not_full = false;
                }

                //glove
                INTR_SarungTangan glove = detect.transform.GetComponent <INTR_SarungTangan>();
                if (glove != null)
                {
                    glove.grab();
                    not_full = false;
                }

                //kapas
                INTR_Kapas kapas = detect.transform.GetComponent <INTR_Kapas>();
                if (kapas != null)
                {
                    kapas.grab();
                    not_full = false;
                }



                //body.enabled = true;

                UnityEngine.Debug.Log(detect.transform.name);
            }
        }
    }