Advertisement
Guest User

Untitled

a guest
Feb 15th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. private Rect GetCursorDrawPosition()
  2. {
  3. float leftPos = Mathf.Clamp(Input.mousePosition.x, 0, Screen.width-activeCursor.width/2);
  4. float topPos = Mathf.Clamp(Screen.height - Input.mousePosition.y, 0, Screen.height-activeCursor.height);
  5.  
  6. if(activeCursorState == CursorState.Move || activeCursorState == CursorState.Select || activeCursorState == CursorState.Harvest)
  7. {
  8. topPos -= activeCursor.height / 2;
  9. leftPos -= activeCursor.width / 2;
  10. }
  11. return new Rect(leftPos, topPos, activeCursor.width, activeCursor.height);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement