Exemple #1
0
        public Leg(Leg.Flags mode, Vector3 init)                            //Default Constructor
        {
            m_startTime = Singleton <SimulationManager> .instance.FrameToTime(Singleton <SimulationManager> .instance.m_currentFrameIndex);

            my_mode       = mode;
            initialVector = init;
        }
Exemple #2
0
 public bool setMode(Leg.Flags f)
 {
     if ((f != Leg.Flags.None) & (my_mode == Leg.Flags.None))
     {
         my_mode &= f;
         return(true);
     }
     return(false);
 }
Exemple #3
0
 public void ResetTrip()                                                                 //Reset a trip (Mistakenly written, likely will never be used)
 {
     activated           = false;
     currentVehicleType  = Leg.Flags.None;
     m_citizen           = 0;
     m_current           = 0;
     m_flags             = CitizenInstance.Flags.None;
     m_legCount          = 0;
     m_legs              = new Leg[0];
     m_source            = 0;
     m_target            = 0;
     previousVehicleType = Leg.Flags.None;
     valid = false;
 }
Exemple #4
0
 public void TryAddLeg()                                                                 //Gets new CitizenInstance flags for analysis: [new , update, ignore, close, invalidate]
 {
     CitizenInstance.Flags t_flags = Singleton <CitizenManager> .instance.m_instances.m_buffer[m_citizen].m_flags;
     if (CheckMoving())                                      //If the CI is moving
     {
         if (CheckNewVehicle())                              //If the CI has a new vehicle
         {
             FinalizeLeg(GetMyPosition());
             AddLeg();                                       //[New]
             previousVehicleType = currentVehicleType;       //Update previousVehicleType
         }
         CheckFlags(t_flags);                                //Check CI flags
         int num = (int)t_flags;                             //Cast CI flags to int
         MediateMode(t_flags);                               //[Update]
     }
     UpdateMyFlags(t_flags);                                 //Update m_flags for next cycle
 }
Exemple #5
0
        private bool CheckNewVehicle()                                                          //Queries and returns bool of if the citizen  has a new vehicle
        {
            bool found = false;

            if (GetValidVehicle())
            {
                VehicleInfo.VehicleType t_mode = GetVehicleType(); //Needs updating
                if (t_mode == VehicleInfo.VehicleType.Bicycle)
                {
                    currentVehicleType = Leg.Flags.Bicycle;
                    found = true;
                }
                if (t_mode == VehicleInfo.VehicleType.Car)
                {
                    currentVehicleType = Leg.Flags.Car;
                    found = true;
                }
                if (t_mode == VehicleInfo.VehicleType.Metro)
                {
                    currentVehicleType = Leg.Flags.Metro;
                    found = true;
                }
                if (t_mode == VehicleInfo.VehicleType.Plane)
                {
                    currentVehicleType = Leg.Flags.Plane;
                    found = true;
                }
                if (t_mode == VehicleInfo.VehicleType.Ship)
                {
                    currentVehicleType = Leg.Flags.Ship;
                    found = true;
                }
                if (t_mode == VehicleInfo.VehicleType.Train)
                {
                    currentVehicleType = Leg.Flags.Train;
                    found = true;
                }
                if (t_mode == VehicleInfo.VehicleType.Tram)
                {
                    currentVehicleType = Leg.Flags.Tram;
                    found = true;
                }
                ItemClass.SubService t_subservice = GetMyVehicle().Info.m_class.m_subService;
                if (t_subservice == ItemClass.SubService.PublicTransportBus)
                {
                    currentVehicleType = Leg.Flags.Bus;
                    found = true;
                }
                if (t_subservice == ItemClass.SubService.PublicTransportTaxi)
                {
                    currentVehicleType = Leg.Flags.Taxi;
                    found = true;
                }
                ItemClass.Service t_service = GetMyVehicle().Info.m_class.m_service;
                if (t_service != ItemClass.Service.None)
                {
                    this.Invalidate();                          //Trip is taking place in a special case and is excluded from consideration with regard to accessibility
                }
                if (!found)                                     //Citizen is moving but without any detectable vehicle. Walking is assumed
                {
                    currentVehicleType = Leg.Flags.Walk;
                }
                if (currentVehicleType != previousVehicleType)  //Checks temporary flag 'found' indicating a new vehicle and returns as bool
                {
                    return(true);
                }
                return(false);
            }
            currentVehicleType = Leg.Flags.Walk;                //Repeated code block. If citizen is moving with an invalid vehicle then walking is assumed
            if (currentVehicleType != previousVehicleType)
            {
                return(true);
            }
            return(false);
        }