Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.SceneManagement;
- public class CameraMoveEnd : MonoBehaviour {
- //private Camera cam;
- private Rigidbody cam_rb;
- public float zPos;
- private Text scoreDisp;
- private int score;
- void Awake () {
- //cam = GetComponent<Camera>();
- cam_rb = GetComponent<Rigidbody> ();
- cam_rb.isKinematic = false;
- scoreDisp = GameObject.Find ("Total Score").GetComponent<Text> ();
- scoreDisp.text = "";
- score = GameController.score;
- }
- void FixedUpdate () {
- if (cam_rb.position.z > zPos) {
- cam_rb.AddForce (new Vector3 (0f, 0f, -5f));
- } else {
- cam_rb.isKinematic = true;
- Debug.Log ("Score : " + score.ToString());
- Debug.Log (score.ToString().GetType());
- scoreDisp.text = "Total Score: " + score.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement