ИИ гонщиков, запуск, перезапуск игры и пр

This commit is contained in:
ThomasCharester committed 2026-02-09 16:22:37 +03:00
1 parent f557c58c9d
commit efcfaae647
48 files changed
+1486 -212

No files matched your search

@@ -1,10 +1,15 @@
using System.Collections.Generic;
using Code.Example.Race.Track;
using Code.Infrastructure.EventBus;
using Reflex.Attributes;
using UnityEngine;
namespace Code.Example.Race.Racer.Player
{
public class PlayerRacer : Racer
{
[Inject] private EventBus _eventBus;
public Transform CameraPosition;
public override void SetData(RacerData data)
{
@@ -13,21 +18,26 @@ namespace Code.Example.Race.Racer.Player
public override void Initialize(List<Transform> waypoints)
{
Waypoints = waypoints;
}
public override void NextWaypoint()
{
if (++CurrentWaypointIndex < Waypoints.Count) return;
CurrentWaypointIndex = 0;
_eventBus.RaiseEvent<IPlayerPassedCheckpointHandler>(x=> x.OnPlayerLapPassed(this));
_eventBus.RaiseEvent<IRacerPassedCheckpointHandler>(x=> x.LapPassed(this));
}
public bool RaceStarted { get; set; }
public override void StartRacer()
{
RaceStarted = true;
}
public override void StopRacer()
{
RaceStarted = false;
}
}
}