random road generation

This commit is contained in:
MrTorex committed 2026-01-27 13:13:48 +03:00
1 parent b974bbd843
commit ee223cabfd
56 files changed
+2952 -169

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
using Code.Track;
using UnityEngine;
namespace Code.UI
{
public class GameplayController : MonoBehaviour
{
[SerializeField] private TrackBuilder trackBuilder;
[SerializeField] private Transform playerSpawn;
[SerializeField] private Transform finishTrigger;
private TrackData _currentTrack;
private void Start()
{
var seed = Random.Range(0, 10000);
_currentTrack = TrackGenerator.Generate(seed, 1000, segmentCount: 30);
trackBuilder.Build(_currentTrack);
playerSpawn.position = _currentTrack.StartPosition;
playerSpawn.rotation = _currentTrack.StartRotation;
finishTrigger.position = _currentTrack.FinishPosition;
}
}
}