예제 #1
0
    void CheckRaycast()
    {
        // Raycasting to detect which tool is showing up
        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.parent.up, out hit, 10f, toolLayer))
        {
            StickerTool s_t = hit.collider.gameObject.GetComponent <StickerTool> ();
            if (!s_t.inUse)
            {
                // disable
                for (int i = 0; i < stickerTools.Count; i++)
                {
                    if (i != s_t.ToolIndex && stickerTools[i].inUse)
                    {
                        stickerTools [i].DisableTool();
                    }
                }

                // enable
                s_t.EnableTool();
                currStickerTool = s_t;
                currToolIndex   = toolIndexCount = s_t.ToolIndex;
            }
        }
    }
예제 #2
0
 public void DisableAllTools()
 {
     for (int i = 0; i < stickerTools.Count; i++)
     {
         stickerTools [i].DisableTool();
     }
     ToolsetEnable   = false;
     currStickerTool = null;
     currToolIndex   = toolIndexCount = -1;
 }
예제 #3
0
    /// <summary>
    /// Tool Swiping of Touchpad on Macbook. For testing only.
    /// </summary>
    /// <param name="currTouchValue">Curr touch value.</param>
    void ToolSwiping(float currTouchValue)
    {
        if (Mathf.Abs(currTouchValue) > 0.15f)
        {
            if (currTouchValue > 0)
            {
                // swipe right
                transform.Rotate(transform.forward * rotDegreePerStep);
            }
            else
            {
                // swipe left
                transform.Rotate(-transform.forward * rotDegreePerStep);
            }
            pastTouchValue = currTouchValue;

            // Raycasting to detect which tool to show up
            RaycastHit hit;
            if (Physics.Raycast(transform.position, transform.parent.up, out hit, 5f, toolLayer))
            {
                var s_t = hit.transform.gameObject.GetComponent <StickerTool> ();
                if (!s_t.inUse)
                {
                    // disable
                    for (int i = 0; i < stickerTools.Count; i++)
                    {
                        if (i != s_t.ToolIndex && stickerTools[i].inUse)
                        {
                            stickerTools [i].DisableTool();
                        }
                    }
                    // enable
                    s_t.EnableTool();
                    currStickerTool = s_t;
                    currToolIndex   = toolIndexCount = s_t.ToolIndex;
                }
            }
        }
    }