public void PushTool(System.Type toolType, BaseTool.ToolHand hand, BaseTool.ToolMode mode)
    {
        PopTool(hand);
        BaseTool activeAttachedTool = m_hydraRef.GetHand(hand).AddComponent(toolType) as BaseTool;

        activeAttachedTool.Init(hand, mode);
    }
Beispiel #2
0
    //Initializer
    public virtual void Init(ToolHand hand, BaseTool.ToolMode mode)
    {
        m_hand = hand;
        m_mode = mode;

        //Set collider model for hand based on active gesture
        glove.SetCollider(glove.activeGesture);

        //Trigger the transition
        TransitionIn();
    }
Beispiel #3
0
    public virtual void Init(T managedReference)
    {
        m_musicRef   = managedReference;
        bHasMusicRef = true;

        //Set default tool filter if not set
        if (m_respondsToToolMode == null)
        {
            m_respondsToToolMode = new BaseTool.ToolMode[] { BaseTool.ToolMode.PRIMARY, BaseTool.ToolMode.SECONDARY }
        }
        ;
    }
    public override void Awake()
    {
        base.Awake();

        //Since instrument attachments are created at runtime, we need to set the filter here
        m_respondsToToolMode = new BaseTool.ToolMode[] {
            BaseTool.ToolMode.PRIMARY,
            BaseTool.ToolMode.GRABBING
        };

        //Set the collision state
        SetCollideable(true);
        SetIsDockable(true);
        SetIsDraggable(true);
        SetCloneable(true);
        SetOutlineMat(renderer.materials[1]);
    }
Beispiel #5
0
    public bool respondsToToolMode(BaseTool.ToolMode mode)
    {
        if (m_respondsToToolMode.Length > 0)
        {
            foreach (BaseTool.ToolMode responder in m_respondsToToolMode)
            {
                if (responder == mode)
                {
                    return(true);
                }
            }

            //Always return true when hovering over an attachment
            if (mode == BaseTool.ToolMode.IDLE)
            {
                return(true);
            }
        }

        return(false);
    }
    public GameObject GetClosestObjectInList(List <GameObject> targetList, GameObject target, BaseTool.ToolMode mode)
    {
        float      closestDistance = -1.0f;
        GameObject closestObject   = null;

        if (targetList != null && target != null)
        {
            foreach (GameObject obj in targetList)
            {
                if (obj != null)
                {
                    float dist = Vector3.Distance(obj.transform.position, target.transform.position);
                    if (dist < closestDistance || closestDistance < 0)
                    {
                        BaseAttachment attach = obj.GetComponent <BaseAttachment>();

                        if (attach != null)
                        {
                            if (attach.respondsToToolMode(mode))
                            {
                                closestDistance = dist;
                                closestObject   = obj;
                            }
                        }
                    }
                }
            }
        }

        return(closestObject);
    }
    /*
     * Returns the the closest object to the hand in a specific proximity list
     */

    public GameObject HandTarget(BaseTool.ToolHand hand, ProximityType proximityTarget, BaseTool.ToolMode mode)
    {
        return(GetClosestObjectInList(GetCollisionList(proximityTarget, BaseTool.ToolHandToSixenseHand(hand)), GetHand(hand), mode));
    }
Beispiel #8
0
 public virtual void SetToolMode(BaseTool.ToolMode mode)
 {
     m_mode = mode;
 }