Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        //Debug.DrawRay(Camera.main.transform.position, Camera.main.transform.forward*ReachLength, Color.red, 0.5f);
        //Casts a Ray in the forward direction of the player
        if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out ObjectHit, ReachLength))
        {
            //Sends information to DescriptionManager to display text
            if (ObjectHit.collider.tag == "InteractiveItem" || ObjectHit.collider.tag == "CollectableItem") //&& Input.GetKeyDown(KeyCode.E) && !TextboxOpen)
            {
                TextboxOpen = true;

                //displays textbox with the describtion of the object
                //Put a timer on
                Description.SetShowText(TextboxOpen);
                Description.SetGrabDescription(ObjectHit);
                //picks up the item if able
            }
            else
            {
                Description.HideText();
            }
        }
        else
        {
            Description.HideText();
        }
    }