Advertisement
D8ms

Untitled

Nov 6th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. public class movement : MonoBehaviour {
  6.  
  7. public float rotationSpeed = (1.0f * Time.deltaTime);
  8. public float bankSpeed = (1.0f * Time.deltaTime);
  9. public float slideSpeed = (1.0f * Time.deltaTime);
  10. public float boostSpeed = (2.0f * Time.deltaTime);
  11.  
  12. void Start () {
  13. if !networkView.IsMine():
  14. gameObject.enable = false;
  15. }
  16.  
  17. void Update() {
  18. rotH();
  19. rotP();
  20. }
  21.  
  22.  
  23. void FixedUpdate () {
  24. rotB();
  25. slideX();
  26. slideY();
  27. slideZ();
  28. boost();
  29.  
  30. Screen.showCursor = false;
  31. Screen.lockCursor = true;
  32. }
  33.  
  34. private void rotH() {
  35. float yaw = rotationSpeed * Input.GetAxis ("Mouse X");
  36. transform.Rotate(0,yaw,0);
  37. }
  38.  
  39. private void rotP() {
  40. float pitch = rotationSpeed * Input.GetAxis ("Mouse Y");
  41. transform.Rotate(-pitch,0,0);
  42. }
  43.  
  44. private void rotB() {
  45. float bank = bankSpeed * Input.GetAxis ("Bank");
  46. transform.Rotate(0,0,bank);
  47. }
  48.  
  49. private void slideX() {
  50. float slideH = slideSpeed * Input.GetAxis ("Horizontal");
  51. transform.Translate(slideH,0,0);
  52. }
  53.  
  54. private void slideY() {
  55. float slideV = slideSpeed * Input.GetAxis ("Vertical");
  56. transform.Translate(0,-slideV,0);
  57. }
  58.  
  59. private void slideZ() {
  60. float throttle = slideSpeed * Input.GetAxis ("Throttle");
  61. transform.Translate(0,0,throttle);
  62. }
  63.  
  64. private void boost() {
  65. float boost = boostSpeed * Input.GetAxis ("Boost");
  66. transform.Translate(0,0,boost);
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement