Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class ObstacleMovement : MonoBehaviour {
- Transform tr;
- void Start () {
- tr = transform;
- tr.rigidbody2D.velocity = new Vector3(-GameManager.GameSpeed * 60, 0, 0);
- }
- void Update () {
- if(tr.position.x < -PlayerPrefs.GetFloat("CameraWidth"))
- {
- Destroy(tr.gameObject);
- }
- if (GameManager.GameSpeed == 0)
- {
- tr.rigidbody2D.velocity = Vector3.zero;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement