Example #1
0
 public void OnMoveSawArm(Gesture gesture)
 {
     if (Moveable && selected && (gesture.swipe == EasyTouch.SwipeDirection.Up || gesture.swipe == EasyTouch.SwipeDirection.Down))
     {
         previousPosition = BladeTransform.position;
         float direction      = (gesture.swipe == EasyTouch.SwipeDirection.Up) ? -1.0f : 1.0f;
         float deltaMagnitude = gesture.deltaPosition.magnitude;
         if (deltaMagnitude > 4.0f)
         {
             deltaMagnitude = 4.0f;
         }
         transform.Rotate(Vector3.right, (deltaMagnitude * direction), Space.Self);
         if (transform.eulerAngles.x > LowerLimit && transform.eulerAngles.x < 180)
         {
             transform.eulerAngles = new Vector3(LowerLimit, transform.eulerAngles.y, transform.eulerAngles.z);
         }
         else if (transform.eulerAngles.x < UpperLimit && transform.eulerAngles.x > 180)
         {
             transform.eulerAngles = new Vector3(UpperLimit, transform.eulerAngles.y, transform.eulerAngles.z);
         }
         else
         {
             float   difference      = BladeTransform.position.y - previousPosition.y;
             Vector3 newEdgePosition = new Vector3(Blade.EdgePosition().x, Blade.EdgePosition().y + difference, Blade.EdgePosition().z);
             Blade.SetEdgePosition(newEdgePosition);
         }
     }
 }
Example #2
0
    private void StartWoodCutting(Vector3 cutStartPoint)
    {
        SawBlade.SetEdgePosition(cutStartPoint);
        currentLine.DetermineCutDirection(SawBlade.EdgePosition());

        float distanceFromBlade = currentLine.CalculateDistance(SawBlade.EdgePosition());

        cuttingAlongLine = (distanceFromBlade <= ValidCutOffset);
        if (cuttingAlongLine && distanceFromBlade >= 0.003f)
        {
            FeedRateTracker.ReduceScoreDirectly(0.5f);
        }
        else if (!cuttingAlongLine)
        {
            FeedRateTracker.ReduceScoreDirectly(1.0f);
        }

        manager.RestrictCurrentBoardMovement(false, true);
        previousPiecePosition = manager.GetCurrentBoardPosition();
        CurrentState          = CutState.Cutting;
        totalTimePassed       = 0.0f;
    }