示例#1
0
    public void AccidentGenerate()
    {
        Accident accident = new Accident();

        for (int i = 0; i < AirportAccident; i++)
        {
            accident.type     = AccidentType.airport;
            accident.location = AirportList[rnd.Next(0, AirportList.Count)];
            AirportList.RemoveAll(x => x == accident.location);
            accident.duration  = rnd.Next(3, 31) * 10;
            accident.starttime = InitTime.AddMinutes(rnd.Next(0, 901));
            accident.text      = AirportAccidentTexts[rnd.Next(0, AirportAccidentTexts.Count)];
            accident           = stringProcess.AccidentStringProcess(accident);
            AccidentList.Add(accident);
        }
        for (int i = 0; i < RailAccident; i++)
        {
            accident.type     = AccidentType.rail;
            accident.location = RailList[rnd.Next(0, RailList.Count)];
            RailList.RemoveAll(x => x == accident.location);
            accident.duration  = rnd.Next(3, 31) * 10;
            accident.starttime = InitTime.AddMinutes(rnd.Next(0, 901));
            accident.text      = RailAccidentTexts[rnd.Next(0, RailAccidentTexts.Count)];
            accident           = stringProcess.AccidentStringProcess(accident);
            AccidentList.Add(accident);
        }


        PushAccidentList();
    }