Advertisement
Guest User

tp_controller

a guest
Jul 12th, 2014
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class tp_controller : MonoBehaviour {
  5.  
  6.     public float speed = 10.0f;
  7.     public float rotspeed = 10.0f;
  8.     public static CharacterController CharacterController;
  9.     public static tp_controller Instance;
  10.  
  11.  
  12.     void Awake() {
  13.    
  14.         CharacterController = GetComponent("CharacterController") as CharacterController;
  15.         Instance = this;
  16.         tp_camera.UseExistingOrCreateNewMainCamera();
  17.     }
  18.    
  19.  
  20.     void Update () {
  21.    
  22.         if(Camera.main == null)
  23.            return;
  24.  
  25.         GetLocomotionInput();
  26.  
  27.         tp_motor.Instance.UpdateMotor();
  28.     }
  29.  
  30.     void GetLocomotionInput()
  31.     {
  32.         var deadzone =0.1f;
  33.  
  34.         tp_motor.Instance.MoveVector = Vector3.zero;
  35.  
  36.    
  37.    
  38.  
  39.         if(Input.GetAxis("Vertical") > deadzone || Input.GetAxis("Vertical") < deadzone)
  40.             tp_motor.Instance.MoveVector += new Vector3(0,0, Input.GetAxis("Vertical"));
  41.             // I need to make a way for the input to send information to make the motor turn??
  42.  
  43.            
  44.        
  45.         if(Input.GetAxis("Horizontal") > deadzone || Input.GetAxis("Horizontal") < deadzone)
  46.             tp_motor.Instance.MoveVector += new Vector3(Input.GetAxis("Horizontal"), 0,0 );
  47.  
  48.  
  49.     }
  50.  
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement