Advertisement
Guest User

ObstacleMovement.cs

a guest
Dec 11th, 2014
229
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ObstacleMovement : MonoBehaviour {
  5.  
  6.     Transform tr;
  7.     void Start () {
  8.         tr = transform;
  9.         tr.rigidbody2D.velocity = new Vector3(-GameManager.GameSpeed * 60, 0, 0);
  10.     }
  11.    
  12.    
  13.     void Update () {
  14.         if(tr.position.x < -PlayerPrefs.GetFloat("CameraWidth"))
  15.         {
  16.             Destroy(tr.gameObject);
  17.         }
  18.         if (GameManager.GameSpeed == 0)
  19.         {
  20.             tr.rigidbody2D.velocity = Vector3.zero;
  21.         }
  22.     }
  23. }
Advertisement
RAW Paste Data Copied
Advertisement