Advertisement
jretchy

Untitled

May 17th, 2022
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1.   [SerializeField]
  2.     private Transform targetToFollow;
  3.  
  4.     static bool cameraExists;
  5.  
  6.     public Animator controlsAnim;
  7.  
  8.     private void Start()
  9.     {
  10.         DontDestroyOnLoad(gameObject.transform);
  11.  
  12.         StartCoroutine(waitToShow());
  13.  
  14.         DontDestroyOnLoad(this.gameObject);
  15.     }
  16.  
  17.     private void Update()
  18.     {
  19.         transform.position = new Vector3(
  20.             Mathf.Clamp(targetToFollow.position.x, -7.32f, 7.41f),
  21.             Mathf.Clamp(targetToFollow.position.y, -1.17f, 5.5f),
  22.             transform.position.z);
  23.     }
  24.  
  25.  
  26.     IEnumerator waitToShow()
  27.     {
  28.         yield return new WaitForSeconds(11);
  29.         controlsAnim.SetBool("ShowControls", true);
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement