Example #1
0
        private ERPathAdapter AppendAdapter(ERModularRoad road, ERPathToVertexPathWrapper wrapper)
        {
            var adapter = road.GetComponent <ERPathAdapter>();

            if (!adapter)
            {
                adapter = (ERPathAdapter)road.gameObject.AddComponent(typeof(ERPathAdapter));
                adapter.initFromWrapper(wrapper);
                DebugLog($"Added new adapter to road {road.name}");
            }
            else
            {
                DebugLog($"Found existing adapter for road {road.name}");
            }

            adapter.initFromWrapper(wrapper);
            return(adapter);
        }
Example #2
0
        private ERPathToVertexPathWrapper AppendWrapper(ERModularRoad road)
        {
            var wrapper = road.GetComponent <ERPathToVertexPathWrapper>();

            if (!wrapper)
            {
                wrapper = (ERPathToVertexPathWrapper)road.gameObject.AddComponent(typeof(ERPathToVertexPathWrapper));
                wrapper.angleThreshold = defaultAngleThreshold;
                wrapper.scanStep       = defaultScanStep;
                DebugLog($"Added new wrapper to road {road.name}");
            }
            else
            {
                DebugLog($"Found existing wrapper for road {road.name}");
            }

            InitVertexPathWrapper(road, wrapper);
            return(wrapper);
        }
Example #3
0
 private void InitVertexPathWrapper(ERModularRoad road, ERPathToVertexPathWrapper wrapper)
 {
     wrapper.Init(road);
     DebugLog($"Wrapper for road {road.name} initialized with {wrapper.Positions.Length} points and {wrapper.TotalDistance} length");
 }
 public void Init(ERModularRoad modularRoad)
 {
     road          = new ERRoadNetwork().GetRoadByGameObject(modularRoad.gameObject);
     totalDistance = road.GetDistance();
     buildRoadVertexPath();
 }