Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class movement : MonoBehaviour {
- public float rotationSpeed = (1.0f * Time.deltaTime);
- public float bankSpeed = (1.0f * Time.deltaTime);
- public float slideSpeed = (1.0f * Time.deltaTime);
- public float boostSpeed = (2.0f * Time.deltaTime);
- void Start () {
- if ((gameObject.GetComponent<of NetworkView>()).isMine == false){
- gameObject.enabled = false;
- }
- }
- void Update() {
- rotH();
- rotP();
- }
- void FixedUpdate () {
- rotB();
- slideX();
- slideY();
- slideZ();
- boost();
- Screen.showCursor = false;
- Screen.lockCursor = true;
- }
- private void rotH() {
- float yaw = rotationSpeed * Input.GetAxis ("Mouse X");
- transform.Rotate(0,yaw,0);
- }
- private void rotP() {
- float pitch = rotationSpeed * Input.GetAxis ("Mouse Y");
- transform.Rotate(-pitch,0,0);
- }
- private void rotB() {
- float bank = bankSpeed * Input.GetAxis ("Bank");
- transform.Rotate(0,0,bank);
- }
- private void slideX() {
- float slideH = slideSpeed * Input.GetAxis ("Horizontal");
- transform.Translate(slideH,0,0);
- }
- private void slideY() {
- float slideV = slideSpeed * Input.GetAxis ("Vertical");
- transform.Translate(0,-slideV,0);
- }
- private void slideZ() {
- float throttle = slideSpeed * Input.GetAxis ("Throttle");
- transform.Translate(0,0,throttle);
- }
- private void boost() {
- float boost = boostSpeed * Input.GetAxis ("Boost");
- transform.Translate(0,0,boost);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement