Advertisement
Guest User

Untitled

a guest
May 17th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.SceneManagement;
  6.  
  7. public class CameraMoveEnd : MonoBehaviour {
  8.  
  9.     //private Camera cam;
  10.     private Rigidbody cam_rb;
  11.     public float zPos;
  12.     private Text scoreDisp;
  13.     private int score;
  14.  
  15.  
  16.  
  17.     void Awake () {
  18.  
  19.         //cam = GetComponent<Camera>();
  20.         cam_rb = GetComponent<Rigidbody> ();
  21.         cam_rb.isKinematic = false;
  22.  
  23.         scoreDisp = GameObject.Find ("Total Score").GetComponent<Text> ();
  24.         scoreDisp.text = "";
  25.         score = GameController.score;
  26.  
  27.     }
  28.  
  29.  
  30.     void FixedUpdate () {
  31.         if (cam_rb.position.z > zPos) {
  32.             cam_rb.AddForce (new Vector3 (0f, 0f, -5f));
  33.         } else {
  34.             cam_rb.isKinematic = true;
  35.             Debug.Log ("Score : " + score.ToString());
  36.             Debug.Log (score.ToString().GetType());
  37.             scoreDisp.text = "Total Score: " + score.ToString();
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement