endless runner
This commit is contained in:
20
Ora1/Assets/Scripts/RoadController.cs
Normal file
20
Ora1/Assets/Scripts/RoadController.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class RoadController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float moveSpeed = 10f;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Invoke("DestroyRoad", 30f);
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
transform.Translate(Vector3.right * (moveSpeed * Time.deltaTime));
|
||||
}
|
||||
|
||||
private void DestroyRoad()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user