// Update is called once per frame
    void Update()
    {
        if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip))
        {
            if (collidingObject)
            {
                GrabObject();
            }
        }

        if (Controller.GetPressUp(SteamVR_Controller.ButtonMask.Grip))
        {
            if (objectInHand)
            {
                ReleaseObject();
            }
        }

        if (Controller.GetHairTriggerDown() && objectInHand != null)
        {
            ItemUse itemUse = objectInHand.GetComponent <ItemUse> ();
            if (itemUse != null)
            {
                itemUse.Use();
                Controller.TriggerHapticPulse(durationMicroSec: 1000);
            }
        }
    }
Example #2
0
    //public string TARGET_NAME
    //{
    //    set { targetName = value; }
    //    get { return targetName; }
    //}
    //public string FUNC_NAME
    //{
    //    set { funcName = value; }
    //    get { return funcName; }
    //}
    //public float EFFECT
    //{
    //    set { effect = value; }
    //    get { return effect; }
    //}

    public virtual int Use()
    {
        return(use.Use());
    }