背景移动的方法
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 }