Exemplo n.º 1
0
        void GetEdgePosition(MarkupPoint.LocationType location, float offset, out Vector3 position, out Vector3 direction)
        {
            float lineShift;

            switch (location)
            {
            case MarkupPoint.LocationType.LeftEdge:
                RightLane.NetLane.CalculatePositionAndDirection(Enter.T, out position, out direction);
                lineShift = -RightLane.HalfWidth;
                break;

            case MarkupPoint.LocationType.RightEdge:
                LeftLane.NetLane.CalculatePositionAndDirection(Enter.T, out position, out direction);
                lineShift = LeftLane.HalfWidth;
                break;

            default:
                throw new Exception();
            }
            direction = (Enter.IsStartSide ? -direction : direction).normalized;

            var shift = (lineShift + offset) / Mathf.Sin(Enter.CornerAndNormalAngle);

            position += Enter.CornerDir * shift;
        }
Exemplo n.º 2
0
        private void GetEdgePositionAndDirection(MarkupPoint.LocationType location, float offset, out Vector3 position, out Vector3 direction)
        {
            float lineShift;

            switch (location)
            {
            case MarkupPoint.LocationType.LeftEdge:
                RightLane.NetLane.CalculatePositionAndDirection(Enter.T, out position, out direction);
                lineShift = -RightLane.HalfWidth;
                break;

            case MarkupPoint.LocationType.RightEdge:
                LeftLane.NetLane.CalculatePositionAndDirection(Enter.T, out position, out direction);
                lineShift = LeftLane.HalfWidth;
                break;

            default:
                throw new Exception();
            }
            direction = (direction * Enter.SideSign).normalized;

            var shift = (lineShift + offset) / Enter.TranformCoef;

            position += Enter.CornerDir * shift;
        }
Exemplo n.º 3
0
 public NetInfoPointSource(Enter enter, DriveLane leftLane, DriveLane rightLane, MarkupPoint.LocationType location)
 {
     Enter     = enter;
     LeftLane  = leftLane;
     RightLane = rightLane;
     Location  = location;
 }
Exemplo n.º 4
0
 public NetInfoPointSource(Enter enter, DriveLane leftLane, DriveLane rightLane, MarkupPoint.LocationType location)
 {
     Enter       = enter;
     LeftLane    = leftLane;
     RightLane   = rightLane;
     Location    = location;
     NetworkType = (LeftLane == null ? NetworkType.None : leftLane.NetworkType) | (RightLane == null ? NetworkType.None : RightLane.NetworkType);
 }
Exemplo n.º 5
0
        public void GetPositionAndDirection(MarkupPoint.LocationType location, float offset, out Vector3 position, out Vector3 direction)
        {
            if ((location & MarkupPoint.LocationType.Between) != MarkupPoint.LocationType.None)
            {
                GetMiddlePosition(offset, out position, out direction);
            }

            else if ((location & MarkupPoint.LocationType.Edge) != MarkupPoint.LocationType.None)
            {
                GetEdgePosition(location, offset, out position, out direction);
            }

            else
            {
                throw new Exception();
            }
        }