void pickup() { if (Input.GetButtonDown("Fire1") || Input.GetButtonDown("Fire2")) { int x = Screen.width / 2; int y = Screen.height / 2; Ray ray = mainCamera.GetComponent <Camera>().ScreenPointToRay(new Vector3(x, y)); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { Berbahaya p = hit.collider.GetComponent <Berbahaya>(); if (p != null) { carrying = true; carriedObject = p.gameObject; p.gameObject.GetComponent <Rigidbody>().isKinematic = true; } } } }
public void KembaliBerbahaya() { Panel.SetActive(true); Berbahaya.SetActive(false); }
public void BukaBerbahaya() { Berbahaya.SetActive(true); Panel.SetActive(false); }