public override void OnPrimaryClickOverlay() { if (IsCursorInPanel()) { return; } if (HoveredNodeId == 0) { return; } ToggleTrafficLight(HoveredNodeId, ref HoveredNodeId.ToNode()); }
bool IsSuitableJunction() { if (HoveredNodeId == 0) { return(false); } NetNode node = HoveredNodeId.ToNode(); if (node.CountSegments() < 2) { return(false); } return(true); }
public override void RenderOverlay(RenderManager.CameraInfo cameraInfo) { base.RenderOverlay(cameraInfo); if (HoveredSegmentId == 0 || HoveredNodeId == 0) { return; } NetNode.Flags nodeFlags = HoveredNodeId.ToNode().m_flags; Color color = GetToolColor(Input.GetMouseButton(0), false); NetTool.RenderOverlay( cameraInfo, ref HoveredSegmentId.ToSegment(), color, color); }
bool IsSuitableRoadForRoadBridge() { if (!HoveredSegmentId.ToSegment().CanConnectPath()) { return(false); } float minDistance = 1 * NetUtil.MPU + NetUtil.MaxNodeHW(HoveredNodeId); if (HoveredNodeId.ToNode().m_flags.IsFlagSet(NetNode.Flags.Middle)) { return(true); } var diff = HitPos - HoveredNodeId.ToNode().m_position; float diff2 = diff.sqrMagnitude; return(diff2 > minDistance * minDistance); }
bool IsSuitableJunction() { if (HoveredNodeId == 0) { return(false); } NetNode node = HoveredNodeId.ToNode(); if (node.CountSegments() < 3) { return(false); } if (!node.Info.CanConnectPath()) { return(false); } return(true); }
internal ushort GetSegmentFromNode() { bool considerSegmentLenght = true; ushort minSegId = 0; if (HoveredNodeId != 0) { NetNode node = HoveredNodeId.ToNode(); Vector3 dir0 = node.m_position - m_mousePosition; float min_angle = float.MaxValue; for (int i = 0; i < 8; ++i) { ushort segmentId = node.GetSegment(i); if (segmentId == 0) { continue; } NetSegment segment = segmentId.ToSegment(); Vector3 dir; if (segment.m_startNode == HoveredNodeId) { dir = segment.m_startDirection; } else { dir = segment.m_endDirection; } float angle = GetAgnele(-dir, dir0); if (considerSegmentLenght) { angle *= segment.m_averageLength; } if (angle < min_angle) { min_angle = angle; minSegId = segmentId; } } } return(minSegId); }