Пример #1
0
    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;
                }
            }
        }
    }
Пример #2
0
 public void KembaliBerbahaya()
 {
     Panel.SetActive(true);
     Berbahaya.SetActive(false);
 }
Пример #3
0
 public void BukaBerbahaya()
 {
     Berbahaya.SetActive(true);
     Panel.SetActive(false);
 }