using UnityEngine;
using System.Collections;
// 배경화면을 스크롤 시키는 함수
public class Background_Flowing : MonoBehaviour {
public float speed = 0.1f;
float Back_Height = 0.0f;
// Use this for initialization
void Start () {
Back_Height = this.gameObject.GetComponent<SpriteRenderer> ().sprite.textureRect.height/100.0f;
}
// Update is called once per frame
void Update () {
this.gameObject.transform.Translate (Vector3.down * Time.deltaTime * speed);
if(this.gameObject.transform.position.y < -(Back_Height)){
this.gameObject.transform.Translate(Vector3.up *2.9f*Back_Height); // 3.0이 아니라 2.9인 이유 : 배경 스크롤 시 이미지들 사이의 간격을 없애기 위해서
}
}
}