Advertisement
D8ms

Untitled

Nov 6th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 ((gameObject.GetComponent<of NetworkView>()).isMine == false){
  14. gameObject.enabled = false;
  15. }
  16. }
  17.  
  18. void Update() {
  19. rotH();
  20. rotP();
  21. }
  22.  
  23.  
  24. void FixedUpdate () {
  25. rotB();
  26. slideX();
  27. slideY();
  28. slideZ();
  29. boost();
  30.  
  31. Screen.showCursor = false;
  32. Screen.lockCursor = true;
  33. }
  34.  
  35. private void rotH() {
  36. float yaw = rotationSpeed * Input.GetAxis ("Mouse X");
  37. transform.Rotate(0,yaw,0);
  38. }
  39.  
  40. private void rotP() {
  41. float pitch = rotationSpeed * Input.GetAxis ("Mouse Y");
  42. transform.Rotate(-pitch,0,0);
  43. }
  44.  
  45. private void rotB() {
  46. float bank = bankSpeed * Input.GetAxis ("Bank");
  47. transform.Rotate(0,0,bank);
  48. }
  49.  
  50. private void slideX() {
  51. float slideH = slideSpeed * Input.GetAxis ("Horizontal");
  52. transform.Translate(slideH,0,0);
  53. }
  54.  
  55. private void slideY() {
  56. float slideV = slideSpeed * Input.GetAxis ("Vertical");
  57. transform.Translate(0,-slideV,0);
  58. }
  59.  
  60. private void slideZ() {
  61. float throttle = slideSpeed * Input.GetAxis ("Throttle");
  62. transform.Translate(0,0,throttle);
  63. }
  64.  
  65. private void boost() {
  66. float boost = boostSpeed * Input.GetAxis ("Boost");
  67. transform.Translate(0,0,boost);
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement