コード例 #1
0
ファイル: Track.cs プロジェクト: thismarvin/racing-network
        private void CreateBoundaries()
        {
            increment = 2;

            Boundaries.Clear();
            for (int i = 0; i < outsideTrack.Lines.Count - increment; i += increment)
            {
                Boundaries.Add(new Boundary(outsideTrack.Lines[i].Origin.X, outsideTrack.Lines[i].Origin.Y, outsideTrack.Lines[i + increment].EndPoint.X, outsideTrack.Lines[i + increment].EndPoint.Y));
            }
            for (int i = 0; i < insideTrack.Lines.Count - increment; i += increment)
            {
                Boundaries.Add(new Boundary(insideTrack.Lines[i].Origin.X, insideTrack.Lines[i].Origin.Y, insideTrack.Lines[i + increment].EndPoint.X, insideTrack.Lines[i + increment].EndPoint.Y));
            }

            OutOfBounds.Clear();
            for (int i = 0; i < outSideOutOfBounds.Lines.Count - increment; i += increment)
            {
                OutOfBounds.Add(new Boundary(outSideOutOfBounds.Lines[i].Origin.X, outSideOutOfBounds.Lines[i].Origin.Y, outSideOutOfBounds.Lines[i + increment].EndPoint.X, outSideOutOfBounds.Lines[i + increment].EndPoint.Y));
            }
            for (int i = 0; i < insideOutOfBounds.Lines.Count - increment; i += increment)
            {
                OutOfBounds.Add(new Boundary(insideOutOfBounds.Lines[i].Origin.X, insideOutOfBounds.Lines[i].Origin.Y, insideOutOfBounds.Lines[i + increment].EndPoint.X, insideOutOfBounds.Lines[i + increment].EndPoint.Y));
            }
        }