28 lines
831 B
C#
28 lines
831 B
C#
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, 2000, segmentCount: 30);
|
|
|
|
trackBuilder.Build(_currentTrack);
|
|
|
|
playerSpawn.position = _currentTrack.StartPosition;
|
|
playerSpawn.rotation = _currentTrack.StartRotation;
|
|
|
|
finishTrigger.position = _currentTrack.FinishPosition;
|
|
finishTrigger.rotation = _currentTrack.FinishRotation;
|
|
}
|
|
}
|
|
} |