Exemplo n.º 1
0
 public void SwapTool()
 {
     if (inactiveTool != null)
     {
         Tool temp = activeTool;
         activeTool   = inactiveTool;
         inactiveTool = temp;
         repositionTools();
         inactiveTool.InActive();
         activeTool.Active();
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        bool  shift  = Input.GetKey(KeyCode.LeftShift);
        float scroll = Input.GetAxis("Mouse ScrollWheel");

        if (shift && scroll != 0)
        {
            if (scroll > 0)
            {
                IncrementTool();
            }
            else
            {
                DecrementTool();
            }
        }
        else
        {
            selectedTool.OnScroll(scroll);
        }

        if (Input.GetKeyDown(KeyCode.Q))
        {
            DecrementTool();
        }
        if (Input.GetKeyDown(KeyCode.E))
        {
            IncrementTool();
        }

        if (Input.GetButtonDown("Fire1"))
        {
            selectedTool.OnLMouse(shift);
        }

        if (Input.GetButtonDown("Fire2"))
        {
            selectedTool.OnRMouse(shift);
        }

        if (Input.GetButtonDown("Fire3"))
        {
            selectedTool.OnMMouse(shift);
        }

        selectedTool.Active();
    }