예제 #1
0
        private void ReadOpponentPathsSection()
        {
            Trace.Assert(ReadLine() == "START OF OPPONENT PATHS");

            int nbrNodes = ReadLineAsInt();

            OpponentPathNodes = new List <OpponentPathNode>();

            for (int i = 0; i < nbrNodes; i++)
            {
                OpponentPathNodes.Add(new OpponentPathNode {
                    Position = ReadLineAsVector3(), Number = i
                });
            }

            int nbrSections = ReadLineAsInt();

            for (int i = 0; i < nbrSections; i++)
            {
                string[] tokens = ReadLine().Split(',');

                OpponentPathNode startNode = OpponentPathNodes[int.Parse(tokens[0])];

                OpponentPath path = new OpponentPath();
                path.Number        = i;
                path.Start         = startNode;
                path.End           = OpponentPathNodes[int.Parse(tokens[1])];
                path.MinSpeedAtEnd = float.Parse(tokens[4]) * 2.2f; //speeds are in BRU (BRender units). Convert to game speed
                path.MaxSpeedAtEnd = float.Parse(tokens[5]) * 2.2f;
                path.Width         = float.Parse(tokens[6]) * 6.5f;
                path.Type          = (PathType)int.Parse(tokens[7]);

                startNode.Paths.Add(path);
            }
        }
예제 #2
0
        private void ReadOpponentPathsSection()
        {
            Trace.Assert(ReadLine() == "START OF OPPONENT PATHS");

            int nbrNodes = ReadLineAsInt();

            OpponentPathNodes = new List<OpponentPathNode>();

            for (int i = 0; i < nbrNodes; i++)
            {
                OpponentPathNodes.Add(new OpponentPathNode { Position = ReadLineAsVector3(), Number=i });
            }

            int nbrSections = ReadLineAsInt();
            for (int i = 0; i < nbrSections; i++)
            {
                string[] tokens = ReadLine().Split(',');

                OpponentPathNode startNode = OpponentPathNodes[int.Parse(tokens[0])];

                OpponentPath path = new OpponentPath();
                path.Number = i;
                path.Start = startNode;
                path.End = OpponentPathNodes[int.Parse(tokens[1])];
                path.MinSpeedAtEnd = float.Parse(tokens[4]) * 2.2f; //speeds are in BRU (BRender units). Convert to game speed
                path.MaxSpeedAtEnd = float.Parse(tokens[5]) * 2.2f;
                path.Width = float.Parse(tokens[6]) * 6.5f;
                path.Type = (PathType)int.Parse(tokens[7]);

                startNode.Paths.Add(path);
            }
        }