public void showTextGlove() { RaycastHit detect; UnityEngine.Debug.Log("NamaGlove"); if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out detect, range)) { INTR_SarungTangan glove = detect.transform.GetComponent <INTR_SarungTangan>(); if (glove != null) { oldSarungTangan = glove; glove.showNamaGlove(); } else { oldSarungTangan.unshowNamaGlove(); } } }
/*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); } } }