Advertisement
Guest User

Untitled

a guest
Dec 7th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CameraController : MonoBehaviour {
  5.  
  6. public GameObject player;
  7.  
  8. private Vector3 offset;
  9.  
  10. private bool paused = false;
  11.  
  12. void Start ()
  13. {
  14. offset = transform.position - player.transform.position;
  15. }
  16.  
  17. void LateUpdate ()
  18. {
  19. transform.position = player.transform.position + offset;
  20. }
  21.  
  22. void Update(){
  23. if(Input.GetKeyUp(KeyCode.P)){
  24. if(!paused){
  25. paused = true;
  26. Time.timeScale = 0;
  27. } else {
  28. paused = false;
  29. Time.timeScale = 1;
  30. }
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement