Предполагается, что цикл, о котором вы говорите, это строки, следующие за комментарием // If the position of the ground is off the left of the screen
. Увеличение скорости будет указано в инструкции if
, которая следует за ней, поскольку именно там происходит цикл.
Я бы воздержался от того, чтобы называть его loop
кстати, просто потому, что он выполняет поиск цикла for
, while
или foreach
при скимминге кода, что приводит к путанице, когда его нет .
Я прокомментировал в вашем коде, где он будет расположен.
public class PlatformMoving : MonoBehaviour
{
public float speed = 1.5f; //How fast the platforms are moving
// use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
// Every frame we look at the position of the ground and it is moved to the left
transform.position = transform.position - (Vector3.right * speed * Time.deltaTime);
// If the position of the ground is off the left of the screen
if (transform.position.x <= -13.05f)
{
// Move it to the far right of the screen
transform.position = transform.position + (Vector3.right * 53.3f);
// Increase speed here
// speed += x;
}
}
}