Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1.  
  2.     public void OnBeginDrag(PointerEventData eventData)
  3.     {
  4.         startPos = GameManager.Instance.player.transform.position;
  5.     }
  6.  
  7.     public void OnDrag(PointerEventData eventData)
  8.     {
  9.  
  10.         endPos = startPos + new Vector3(eventData.delta.x * GameManager.Instance.land.localScale.x / Screen.width,
  11.                      0, 0);
  12.  
  13.         transitPos = startPos;
  14.         transitPos = Vector3.Lerp(transitPos, endPos, 0.5f);
  15.  
  16.         GameManager.Instance.player.GetComponent<CharacterController>().Move(transitPos - startPos);
  17.  
  18.         startPos = transitPos;
  19.  
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement