Unity
Unity Arkaplan Tekrarlayıcı
Unity 2D Arkaplan Tekrarlama Kodu
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class scrollingObject : MonoBehaviour
{
[Range(1f, 20f)]
public float scrollSpeed = 1f;
public float scrollOffset;
Vector2 startPos;
float newPos;
void Start()
{
startPos = transform.position;
}
void Update()
{
if (!GameController.instance.gameOver)
{
newPos = Mathf.Repeat(Time.time * -scrollSpeed, scrollOffset);
transform.position = startPos + Vector2.right * newPos;
}
}
}
using System.Collections.Generic;
using UnityEngine;
public class scrollingObject : MonoBehaviour
{
[Range(1f, 20f)]
public float scrollSpeed = 1f;
public float scrollOffset;
Vector2 startPos;
float newPos;
void Start()
{
startPos = transform.position;
}
void Update()
{
if (!GameController.instance.gameOver)
{
newPos = Mathf.Repeat(Time.time * -scrollSpeed, scrollOffset);
transform.position = startPos + Vector2.right * newPos;
}
}
}
Yorum Gönder
0 Yorumlar