Развитие гоночек

This commit is contained in:
ThomasCharester committed 2026-02-06 10:30:50 +03:00
1 parent ec60c47652
commit b54083521f
532 files changed
+16091 -28231

No files matched your search

+11 -1
View File
@@ -1,14 +1,24 @@
using Code.Example.Race.Racer.AI;
using Code.Infrastructure.EventBus;
using Reflex.Attributes;
using UnityEngine;
namespace Code.Example.Race.Track
{
public class CheckPoint : MonoBehaviour
{
[Inject] private EventBus _eventBus;
private void OnTriggerEnter(Collider other)
{
var racer = other.GetComponent<AIDebugRacer>();
var racer = other.GetComponent<Racer.AI.Racer>();
racer.NextWaypoint();
_eventBus.RaiseEvent<IRacerPassedCheckpointHandler>(h => h.OnRacerPassedCheckpoint(racer));
}
}
public interface IRacerPassedCheckpointHandler : IGlobalSubscriber
{
void OnRacerPassedCheckpoint(Racer.AI.Racer racer);
}
}
@@ -0,0 +1,18 @@
using System.Collections.Generic;
using UnityEngine;
namespace Code.Example.Race.Track
{
public class RaceTrackData : MonoBehaviour
{
public Transform CameraPosition;
public TrackData trackData;
}
[System.Serializable]
public struct TrackData
{
public List<Transform> RacerPoints;
public List<Transform> Checkpoints;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1847a22e722c47c48ec0ce7d5a929580
timeCreated: 1769686034
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: af09293375544928a9b19a6b697f214e
timeCreated: 1770036714
@@ -0,0 +1,39 @@
namespace Code.Example.Race.Track.WellEditor
{
using UnityEngine;
using UnityEditor;
public static class CheckPointAsset
{
[MenuItem("GameObject/Track/CheckPoint", false, 1)]
private static void CreateCustomPrefab()
{
// Define the path to your prefab in the Project (must be in an "Assets" relative path)
var prefabPath = "Assets/Resources/Example/Misc/Point.prefab"; // Update with your actual path
// Load the prefab asset
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath);
if (!prefab)
{
Debug.LogError("Prefab not found at path: " + prefabPath);
return;
}
// Instantiate the prefab in the scene
var newInstance = (GameObject)PrefabUtility.InstantiatePrefab(prefab);
// Ensure it is placed correctly in the Hierarchy and is undoable
Undo.RegisterCreatedObjectUndo(newInstance, "Create Custom Prefab");
Selection.activeGameObject = newInstance;
// Set parent if an object is selected
if (!Selection.activeTransform)
{
newInstance.transform.parent = Selection.activeTransform;
newInstance.transform.localPosition = Vector3.zero;
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7d55e4bcf05848eea361440799c21d7e
timeCreated: 1770036738