背景移动的方法

1 public void BackGrandMove(float MoveSpeed)//使背景移动的方法
2     {
3         this.transform.Translate(Vector3.down * MoveSpeed * Time.deltaTime);
4         Vector3 position = this.transform.position;
5         if (position.y <= -10)                                                  //判断当前背景的位置是否到达-10的位置
6         {
7             this.transform.position = new Vector3(position.x, position.y + 10f * 2, position.z);//是则将背景移动到y轴10*2的位置
8         }
9     }

 

posted @ 2016-03-31 15:13  礼桀  阅读(158)  评论(0编辑  收藏  举报