Example #1
0
        public static PathManagerExtendedTool Create()
        {
            Log.Debug("PathManagerExtendedTool.Create()");
            GameObject toolModControl = ToolsModifierControl.toolController.gameObject;

            Instance = toolModControl.AddComponent <PathManagerExtendedTool>();
            Log.Info($"Tool created");
            return(Instance);
        }
Example #2
0
 public static void Remove()
 {
     Log.Debug("PathManagerExtendedTool.Remove()");
     if (Instance != null)
     {
         Destroy(Instance);
         Instance = null;
         Log.Info($"Tool removed");
     }
 }
        public override void OnUpdate()
        {
            RaycastInput nodeInput = new RaycastInput(PathManagerExtendedTool.MouseRay, PathManagerExtendedTool.MouseRayLength)
            {
                m_ignoreTerrain      = true,
                m_ignoreNodeFlags    = NetNode.Flags.None,
                m_ignoreSegmentFlags = NetSegment.Flags.All
            };

            nodeInput.m_netService.m_itemLayers = (ItemClass.Layer.Default | ItemClass.Layer.MetroTunnels);
            nodeInput.m_netService.m_service    = ItemClass.Service.Road;

            if (PathManagerExtendedTool.RayCast(nodeInput, out RaycastOutput nodeOutput))
            {
                HoveredNodeId    = nodeOutput.m_netNode;
                HoveredSegmentId = 0;
                return;
            }

            HoveredNodeId = 0;

            RaycastInput segmentInput = new RaycastInput(PathManagerExtendedTool.MouseRay, PathManagerExtendedTool.MouseRayLength)
            {
                m_ignoreTerrain      = true,
                m_ignoreSegmentFlags = NetSegment.Flags.None,
                m_ignoreNodeFlags    = NetNode.Flags.All
            };

            segmentInput.m_netService.m_itemLayers = (ItemClass.Layer.Default | ItemClass.Layer.MetroTunnels);
            segmentInput.m_netService.m_service    = ItemClass.Service.Road;

            if (PathManagerExtendedTool.RayCast(segmentInput, out RaycastOutput segmentOutput))
            {
                HoveredSegmentId = segmentOutput.m_netSegment;
                return;
            }

            HoveredSegmentId = 0;
        }