Exemplo n.º 1
0
    public float getLaneCenterOffset(int laneNum, bool direction)
    {
        if (laneNum < 0 || laneNum >= validLaneCount(direction))
        {
            Debug.Assert(false);
            return(0);
        }

        laneNum = direction ? totalLaneCount - 1 - laneNum : laneNum;
        for (int foundLanes = 0, j = 0; foundLanes <= laneNum; j++)
        {
            if (laneconfigure[j] == "lane")
            {
                foundLanes++;
            }
            if (foundLanes == laneNum + 1)
            {
                return(RoadRenderer.getConfigureWidth(laneconfigure.GetRange(0, j)) +
                       0.5f * RoadRenderer.getConfigureWidth(laneconfigure.GetRange(j, 1)) -
                       0.5f * width);
            }
        }

        Debug.Assert(false);
        return(0);
    }
Exemplo n.º 2
0
    void updateLaneCenterOffsetBackend()
    {
        forwardLaneCenterOffsetBackend = new float[totalLaneCount];

        for (int foundLanes = 0, j = 0; foundLanes != totalLaneCount; ++j)
        {
            if (laneconfigure[j] == "lane")
            {
                forwardLaneCenterOffsetBackend[foundLanes] = RoadRenderer.getConfigureWidth(laneconfigure.GetRange(0, j)) +
                                                             0.5f * RoadRenderer.getConfigureWidth(laneconfigure.GetRange(j, 1)) -
                                                             0.5f * width;
                foundLanes++;
            }
        }
    }