Ejemplo n.º 1
0
    private void InstantiateCheckpoints(TrackDTO mapDTO)
    {
        track.LapTracker.transform.DestroyChildren();

        foreach (var checkpointDTO in mapDTO.Checkpoints)
        {
            GameObject gameObj = ResourcesLoader.LoadRoadObject("Checkpoint");
            gameObj.transform.SetParent(track.LapTracker.transform);

            Mapper.Map(checkpointDTO, gameObj.GetComponent <Checkpoint>());
            gameObj.GetComponent <Checkpoint>().SetOrder(gameObj.GetComponent <Checkpoint>().CheckpointOrder);
        }
    }
Ejemplo n.º 2
0
    private void InstantiateWaypoints(TrackDTO mapDTO)
    {
        track.WayPointCircuit.transform.DestroyChildren();

        foreach (var waypointDTO in mapDTO.Waypoints)
        {
            GameObject gameObj = ResourcesLoader.LoadRoadObject("WaypointNode");
            gameObj.transform.SetParent(track.WayPointCircuit.transform);

            Mapper.Map(waypointDTO, gameObj.GetComponent <WaypointNode>());
        }

        if (mapDTO.Waypoints.Length > 0)
        {
            track.WayPointCircuit.CachePositionsAndDistances();
        }
    }