Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        PuPs = GameObject.FindObjectOfType <PickupPlayerScript> ().GetComponent <PickupPlayerScript> ();
        //dialogue = GameObject.FindObjectOfType<DialogManager> ().GetComponent<DialogManager> ();
        dr = GameObject.FindObjectOfType <dialogReader> ().GetComponent <dialogReader> ();



        //for (int i = 0; i < specialobjects.Count; i++) {
        //specialobjects [i].SetActive (false);

        //}
        specialobj.SetActive(false);
        specialobj1.SetActive(false);
        specialobj2.SetActive(false);
    }
Exemplo n.º 2
0
    public void pickUpFunc()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;

            Ray        rayCheck = mainCamCamObj.ScreenPointToRay(new Vector3(x, y));
            RaycastHit hitCheck;
            if (Physics.Raycast(rayCheck, out hitCheck))
            {
                PickupableScript p = hitCheck.collider.GetComponent <PickupableScript> ();
                if (p != null)
                {
                    carrying              = true;
                    carriedObj            = p.gameObject;
                    cObjRBody             = p.gameObject.GetComponent <Rigidbody> ();
                    cObjRBody.useGravity  = false;
                    cObjRBody.isKinematic = false;
                    //carriedObj.tag = "box";

                    /* This is where the call goes out to check if the object picked up has a
                     * dialogReader script attached to it. If it does, it will return the readlines
                     * functions and the item description will appear.
                     * If it doesn't, it will null out but not cause the game to crash.
                     * *figured it was necessary to implement that in case we forget an object at
                     * any point. */

                    dialogReader itemdescript = carriedObj.gameObject.GetComponent <dialogReader> ();
                    if (itemdescript != null)
                    {
                        itemdescript.readlines();
                        BT.objectcount++;
                    }
                    else
                    {
                        Debug.Log("null");
                    }
                }
            }
        }
    }