Esempio n. 1
0
        private void BuildEvents(long length)
        {
            _events = new RoadEvent[0];

            RoadEvent firstEvent = new RoadEvent();
            firstEvent.Distance = 0;
            firstEvent.Curve = 0;
            _events[_events.Length] = firstEvent;

            long distance = 30000 + Math.Floor(Math.Random() * 100000);
            while (distance < length - 10000)
            {
                RoadEvent roadEvent = new RoadEvent();

                roadEvent.Distance = distance;
                roadEvent.Curve = 0.005f - Math.Random() * 0.01f;

                if (Math.Random() * 11 > 4) roadEvent.Curve = 0;

                _events[_events.Length] = roadEvent;

                distance += 10000 + Math.Floor(Math.Random() * 100000);
            }

            RoadEvent lastEvent = new RoadEvent();
            lastEvent.Distance = length;
            lastEvent.Curve = 0;
            _events[_events.Length] = lastEvent;
        }