Beispiel #1
0
 void ThrottleReset()
 {
     //If the handle is not being grabbed
     if (!HandleGrabbed)
     {
         //Re center the Position of the Handle
         ThrottlePositon = HANDLEPOSITION.CENTER;
     }
     //If ReleaseReset it Active and the handle hits the ceneter Position
     if (ReleaseReset && ThrottlePositon == HANDLEPOSITION.CENTER)
     {
         //Reset the value to Zero
         Value = 0;
     }
 }
Beispiel #2
0
 void AjustThrottle()
 {
     //If the handle is being grabbed
     if (HandleGrabbed)
     {
         //Get the default position of the handle
         Vector3 DefaultPosition = new Vector3(HandleTransform.localPosition.x, 0, HandleTransform.localPosition.z);
         //Get the offset of the mouse compared to the parent
         float DifferenceInY = ParentTransform.position.y - Input.mousePosition.y;
         //Handle's position is now the Default position plus the offset
         HandleTransform.localPosition = DefaultPosition + new Vector3(0, ((DifferenceInY > 100) ? -100 : (DifferenceInY < -100) ? 100 : 0), 0);
         //Sets the Throttles positioning
         ThrottlePositon = (DifferenceInY > 100) ? HANDLEPOSITION.DOWN : (DifferenceInY < -100) ? HANDLEPOSITION.UP : HANDLEPOSITION.CENTER;
     }
     else
     {
         //Put handle back in the center
         HandleTransform.localPosition = Vector3.zero;
     }
 }