Advertisement
Guest User

Untitled

a guest
Feb 1st, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using UnityEngine;
  6.  
  7. namespace Assets.TransitionMaster.Scripts
  8. {
  9. public class CharacterControllerTest :MonoBehaviour
  10. {
  11.  
  12. public float Z;
  13. public float HorizontalSpeed = 10;
  14. public float Jump = 10;
  15.  
  16. public void Start()
  17. {
  18. this.rigidbody.freezeRotation = true;
  19. }
  20. public void Update()
  21. {
  22.  
  23. this.transform.position = new Vector3(this.transform.position.x,this.transform.position.y,Z);
  24.  
  25. var h = Input.GetAxis("Horizontal");
  26.  
  27. this.rigidbody.velocity += Vector3.right*h * HorizontalSpeed * Time.deltaTime;
  28.  
  29.  
  30. if (Input.GetKey(KeyCode.Space))
  31. {
  32. this.rigidbody.velocity += Vector3.up*Jump;
  33. }
  34.  
  35.  
  36. //Remove this to change the camera this is just for testing
  37.  
  38. }
  39.  
  40. public void LateUpdate()
  41. {
  42. Camera.main.transform.position = this.transform.position - 20*Vector3.forward;
  43. }
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement