Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. using System.Collections;
  2. using UnityEngine;
  3.  
  4. public class PlayerController : MonoBehaviour
  5. {
  6. public float moveSpeedup;
  7. public float moveSpeeddown;
  8. public float rotateSpeed;
  9. public bool moveup;
  10. public bool movedown;
  11. public bool rotateleft;
  12. public bool rotateright;
  13. void Update()
  14. {
  15. if ((Input.GetKey(KeyCode.UpArrow)) || moveup)
  16. {
  17. transform.Translate(Vector3.right * moveSpeedup * Time.deltaTime);
  18. }
  19. if (Input.GetKey(KeyCode.DownArrow) || movedown)
  20. {
  21. transform.Translate(-Vector3.right * moveSpeeddown * Time.deltaTime);
  22. }
  23. if (Input.GetKey(KeyCode.RightArrow) || rotateleft)
  24. {
  25. transform.Rotate(Vector3.forward * rotateSpeed * Time.deltaTime);
  26. }
  27. if (Input.GetKey(KeyCode.LeftArrow) || rotateright)
  28. {
  29. transform.Rotate(Vector3.forward * -rotateSpeed * Time.deltaTime);
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement