21 lines
380 B
C#
21 lines
380 B
C#
|
|
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);
|
||
|
|
}
|
||
|
|
}
|