Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vector2 movement = new Vector2(CrossPlatformInputManager.GetAxis("Horizontal"), CrossPlatformInputManager.GetAxis("Vertical"));
- //Vector3 movement = new Vector3(CnInputManager.GetAxis("Horizontal"), CnInputManager.GetAxis("Vertical"), 0f);
- if (Mathf.Abs(movement.x) > 0.2 || Mathf.Abs(movement.y) > 0.2)
- {
- if (Mathf.Abs(movement.x) > Mathf.Abs(movement.y))
- {
- //right
- if (movement.x > 0)
- {
- rightPressed();
- }
- //left
- else if (movement.x < 0)
- {
- leftPressed();
- }
- }
- else
- {
- //up
- if (movement.y > 0)
- {
- upPressed();
- }
- //down
- else if (movement.y < 0)
- {
- downPressed();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement