Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class cameraMovement : MonoBehaviour {
- public float speed;
- public bool gameOver;
- void Start(){
- }
- void Update(){
- if(!gameOver){
- transform.Translate(1 * Time.deltaTime * speed,0,0);
- }
- }
- public void GameOver(){
- gameOver = true;
- }
- void OnTriggerExit2D(Collider2D col)
- {
- if(col.gameObject.tag == "Player"){
- Destroy (col.gameObject);
- UI_Menu.gameOver = true;
- var CameraObjects = FindObjectsOfType<cameraMovement>();
- CameraObjects[0].gameObject.SendMessage("GameOver");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement