예제 #1
0
 private void updateBrushSize(Hand hand)
 {
     if (selectingBrushAction.GetAxisDelta(hand.handType).x >= 0.3f)
     {
         if (!didTick)
         {
             if (brushSize > 1)
             {
                 brushSize--;
                 didTick = true;
                 tileInteractor.setBrushSize(brushSize);
                 tileInteractor.brushSizeSlider.value = brushSize;
             }
         }
     }
     else if (selectingBrushAction.GetAxisDelta(hand.handType).x <= -0.3f)
     {
         if (!didTick)
         {
             if (brushSize < tileInteractor.brushSizeSlider.maxValue)
             {
                 brushSize++;
                 didTick = true;
                 tileInteractor.setBrushSize(brushSize);
                 tileInteractor.brushSizeSlider.value = brushSize;
             }
         }
     }
     else if (selectingBrushAction.GetAxisDelta(hand.handType).x == 0)
     {
         didTick = false;
     }
 }
예제 #2
0
    void Update()
    {
        //Debug.Log(hand.transform.position);

        if (fallbackManagerScript.isInFallBack)
        {
            if (Input.GetButtonDown("Fire1"))
            {
                Ray ray = fallbackManagerScript.fallbackCam.ScreenPointToRay(Input.mousePosition);
                if (!handleRayCastHit(ray))
                {
                    if (Input.GetMouseButtonDown(0) && !inMenu)
                    {
                        //Debug.Log("Ticking");
                        TileInteractor.instance.setBrushTicking(true);
                        //Debug.Log("ticking");
                    }
                    else
                    {
                        //Debug.Log("no ticking");
                    }
                }
            }
            if (Input.GetMouseButtonUp(0))
            {
                TileInteractor.instance.setBrushTicking(false);
            }
        }
        else
        {
            if (clicked)
            {
                clicked = false;
                HandFingerScript.instance.clicked = true;

                Ray ray = new Ray(hand.gameObject.transform.position, hand.gameObject.transform.TransformDirection(Vector3.forward));
                if (!handleRayCastHit(ray) && !HandFingerScript.instance.inLeftCanvas)
                {
                    tileInteractor.setBrushTicking(true);
                }

                //if (Physics.Raycast(hand.gameObject.transform.position, hand.gameObject.transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity))

                if (HandFingerScript.lastSelectedButton != null)
                {
                    handleCollisionClick(HandFingerScript.lastSelectedButton.gameObject);
                }



                if (HandFingerScript.instance.brushSliderDirty)
                {
                    tileInteractor.setBrushSize(HandFingerScript.instance.brushSliderPos + 1);
                    tileInteractor.brushSizeSlider.value       = HandFingerScript.instance.brushSliderPos + 1;
                    HandFingerScript.instance.brushSliderDirty = false;
                    Debug.Log("Something");
                }
            }
            else
            {
                tileInteractor.setBrushTicking(false);
            }
        }
    }