コード例 #1
0
        private void ReadPedestrianSection()
        {
            Peds = new List <Pedestrian>();

            ReadLine(); //# of pedsubs
            int nbrPeds = ReadLineAsInt();

            for (int i = 0; i < nbrPeds; i++)
            {
                Pedestrian ped = new Pedestrian();
                ped.RefNumber = ReadLineAsInt();

                int nbrInstructions = ReadLineAsInt();
                ped.InitialInstruction = ReadLineAsInt() - 1;  //1-based
                for (int j = 0; j < nbrInstructions; j++)
                {
                    string type = ReadLine();
                    if (type == "point")
                    {
                        PedestrianInstruction instruction = new PedestrianInstruction();
                        instruction.Position = ReadLineAsVector3();
                        if (instruction.Position.Y > 500)
                        {
                            instruction.Position.Y -= PEDESTRIAN_AUTO_Y_FLAG;
                            instruction.AutoY       = true;
                        }
                        ped.Instructions.Add(instruction);
                    }
                    else if (type == "reverse")
                    {
                        ped.Instructions[ped.Instructions.Count - 1].Reverse = true;
                        if (ped.InitialInstruction >= j)
                        {
                            ped.InitialInstruction--;
                        }
                    }
                    else
                    {
                    }
                }
                Peds.Add(ped);
            }
        }
コード例 #2
0
ファイル: RaceFile.cs プロジェクト: sikora507/OpenC1
        private void ReadPedestrianSection()
        {
            Peds = new List<Pedestrian>();

            ReadLine(); //# of pedsubs
            int nbrPeds = ReadLineAsInt();

            for (int i = 0; i < nbrPeds; i++)
            {
                Pedestrian ped = new Pedestrian();
                ped.RefNumber = ReadLineAsInt();

                int nbrInstructions = ReadLineAsInt();
                ped.InitialInstruction = ReadLineAsInt() -1;  //1-based
                for (int j = 0; j < nbrInstructions; j++)
                {
                    string type = ReadLine();
                    if (type == "point")
                    {
                        PedestrianInstruction instruction = new PedestrianInstruction();
                        instruction.Position = ReadLineAsVector3();
                        if (instruction.Position.Y > 500)
                        {
                            instruction.Position.Y -= PEDESTRIAN_AUTO_Y_FLAG;
                            instruction.AutoY = true;
                        }
                        ped.Instructions.Add(instruction);
                    }
                    else if (type == "reverse")
                    {
                        ped.Instructions[ped.Instructions.Count - 1].Reverse = true;
                        if (ped.InitialInstruction >= j) ped.InitialInstruction--;
                    }
                    else
                    {
                    }
                }
                Peds.Add(ped);
            }
        }