Exemple #1
0
        private void GenerateTextures()
        {
            mpBlock    = new MaterialPropertyBlock();
            texLanes   = NormLanes.ScaleInt(texture.width / 4, texture.width / 2);
            texIndex   = 0;
            texPending = true;

            CalcStripeColors();
        }
Exemple #2
0
        private void Refresh()
        {
            spline = spline ?? FindObjectOfType <BezierSpline>();
            spline.Refresh();

            int n = chunkCount * ringsPerChunk;

            Positions = new SearchableLocations <Position>(n);
            for (int i = 0; i < n; i++)
            {
                Positions.Add(new Position(1f / n * i, spline));
            }

            int   avgRange    = Mathf.Max(1, Mathf.RoundToInt(Positions.Count / 2 * smoothing));
            float twistAmount = twist * (chunkCount * ringsPerChunk / 8); // TBD

            for (int i = 0; i < n; i++)
            {
                Positions[i].Rotate(Positions, avgRange, twistAmount);
            }

            n       /= segmentLength;
            Segments = new SearchableLocations <Segment>(n);
            for (int i = 0; i < n; i++)
            {
                Segments.Add(new Segment(
                                 Positions[i * segmentLength],
                                 Positions[(i + 1) * segmentLength],
                                 laneCount));
            }

            NormLanes  = new Lanes(laneCount, laneExtent, laneGap);
            gizmoLanes = NormLanes.Scale(radiusX);

            // Same for all locations, constant track width.
            TrackLocation.OrthoLength = radiusX;
        }