Ejemplo n.º 1
0
        private static bool IsAICustom(VehicleAI ai)
        {
            Type type = ai.GetType();

            return((type != typeof(AmbulanceAI) ||
                    type != typeof(BusAI) ||
                    type != typeof(CargoTruckAI) ||
                    type != typeof(FireTruckAI) ||
                    type != typeof(GarbageTruckAI) ||
                    type != typeof(HearseAI) ||
                    type != typeof(PassengerCarAI) ||
                    type != typeof(PoliceCarAI)) ||
                   type != typeof(TaxiAI) ||
                   type != typeof(TramAI) ||
                   type != typeof(MaintenanceTruckAI) ||
                   type != typeof(WaterTruckAI) ||
                   type != typeof(ParkMaintenanceVehicleAI) ||
                   type != typeof(SnowTruckAI) ||
                   type != typeof(CableCarAI) ||
                   type != typeof(TrolleybusAI) ||
                   type != typeof(PassengerFerryAI) ||
                   type != typeof(PassengerBlimpAI) ||
                   type != typeof(PostVanAI) ||
                   type != typeof(PassengerHelicopterAI));
        }
Ejemplo n.º 2
0
        private static bool IsAICustom(VehicleAI ai)
        {
            Type type = ai.GetType();

            return(type != typeof(AmbulanceAI) ||
                   type != typeof(BusAI) ||
                   type != typeof(CargoTruckAI) ||
                   type != typeof(FireTruckAI) ||
                   type != typeof(GarbageTruckAI) ||
                   type != typeof(HearseAI) ||
                   type != typeof(PassengerCarAI) ||
                   type != typeof(PoliceCarAI));
        }
Ejemplo n.º 3
0
 static void SimulationStep(VehicleAI _this, ushort vehicleID, ref Vehicle data, Vector3 physicsLodRefPos)
 {
     try
     {
         _this.SimulationStep(vehicleID, ref data, physicsLodRefPos);
     }
     catch (Exception e)
     {
         string info = $"An exception occured during VehicleAI simulation step.\nAsset: {_this.m_info.name}" +
                       $"\nVehicleID: {vehicleID}\nType: {_this.GetType().Name}\nSeverity: High";
         HealkitException e2 = new HealkitException(info, e);
         e2.m_uniqueData   = _this.m_info.name;
         e2.m_supperessMsg = "Suppress similar exceptions caused by this asset";
         UIView.ForwardException(e2);
     }
 }
		internal static ExtVehicleType? DetermineVehicleTypeFromAIType(VehicleAI ai, bool emergencyOnDuty) {
			switch (ai.m_info.m_vehicleType) {
				case VehicleInfo.VehicleType.Bicycle:
					return ExtVehicleType.Bicycle;
				case VehicleInfo.VehicleType.Car:
					if (ai is PassengerCarAI)
						return ExtVehicleType.PassengerCar;
					if (ai is AmbulanceAI || ai is FireTruckAI || ai is PoliceCarAI) {
						if (emergencyOnDuty)
							return ExtVehicleType.Emergency;
						return ExtVehicleType.Service;
					}
					if (ai is CarTrailerAI)
						return ExtVehicleType.None;
					if (ai is BusAI)
						return ExtVehicleType.Bus;
					if (ai is TaxiAI)
						return ExtVehicleType.Taxi;
					if (ai is CargoTruckAI)
						return ExtVehicleType.CargoTruck;
					if (ai is HearseAI || ai is GarbageTruckAI || ai is MaintenanceTruckAI || ai is SnowTruckAI)
						return ExtVehicleType.Service;
					break;
				case VehicleInfo.VehicleType.Metro:
				case VehicleInfo.VehicleType.Train:
					if (ai is PassengerTrainAI)
						return ExtVehicleType.PassengerTrain;
					if (ai is CargoTrainAI)
						return ExtVehicleType.CargoTrain;
					break;
				case VehicleInfo.VehicleType.Tram:
					return ExtVehicleType.Tram;
				case VehicleInfo.VehicleType.Ship:
					if (ai is PassengerShipAI)
						return ExtVehicleType.PassengerShip;
					//if (ai is CargoShipAI)
						return ExtVehicleType.CargoShip;
					//break;
				case VehicleInfo.VehicleType.Plane:
					//if (ai is PassengerPlaneAI)
						return ExtVehicleType.PassengerPlane;
					//break;
			}
			Log._Debug($"Could not determine vehicle type from ai type: {ai.GetType().ToString()}");
			return null;
		}
Ejemplo n.º 5
0
        internal static ExtVehicleType?DetermineVehicleTypeFromAIType(VehicleAI ai, bool emergencyOnDuty)
        {
            switch (ai.m_info.m_vehicleType)
            {
            case VehicleInfo.VehicleType.Bicycle:
                return(ExtVehicleType.Bicycle);

            case VehicleInfo.VehicleType.Car:
                if (ai is PassengerCarAI)
                {
                    return(ExtVehicleType.PassengerCar);
                }
                if (ai is AmbulanceAI || ai is FireTruckAI || ai is PoliceCarAI)
                {
                    if (emergencyOnDuty)
                    {
                        return(ExtVehicleType.Emergency);
                    }
                    return(ExtVehicleType.Service);
                }
                if (ai is CarTrailerAI)
                {
                    return(ExtVehicleType.None);
                }
                if (ai is BusAI)
                {
                    return(ExtVehicleType.Bus);
                }
                if (ai is TaxiAI)
                {
                    return(ExtVehicleType.Taxi);
                }
                if (ai is CargoTruckAI)
                {
                    return(ExtVehicleType.CargoTruck);
                }
                if (ai is HearseAI || ai is GarbageTruckAI || ai is MaintenanceTruckAI || ai is SnowTruckAI)
                {
                    return(ExtVehicleType.Service);
                }
                break;

            case VehicleInfo.VehicleType.Metro:
            case VehicleInfo.VehicleType.Train:
                if (ai is PassengerTrainAI)
                {
                    return(ExtVehicleType.PassengerTrain);
                }
                if (ai is CargoTrainAI)
                {
                    return(ExtVehicleType.CargoTrain);
                }
                break;

            case VehicleInfo.VehicleType.Tram:
                return(ExtVehicleType.Tram);

            case VehicleInfo.VehicleType.Ship:
                if (ai is PassengerShipAI)
                {
                    return(ExtVehicleType.PassengerShip);
                }
                //if (ai is CargoShipAI)
                return(ExtVehicleType.CargoShip);

            //break;
            case VehicleInfo.VehicleType.Plane:
                //if (ai is PassengerPlaneAI)
                return(ExtVehicleType.PassengerPlane);
                //break;
            }
            Log._Debug($"Could not determine vehicle type from ai type: {ai.GetType().ToString()}");
            return(null);
        }
Ejemplo n.º 6
0
        private ExtVehicleType?DetermineVehicleTypeFromAIType(
            ushort vehicleId,
            VehicleAI ai,
            bool emergencyOnDuty)
        {
            if (emergencyOnDuty)
            {
                return(ExtVehicleType.Emergency);
            }

            switch (ai.m_info.m_vehicleType)
            {
            case VehicleInfo.VehicleType.Bicycle: {
                return(ExtVehicleType.Bicycle);
            }

            case VehicleInfo.VehicleType.Car: {
                switch (ai)
                {
                case PassengerCarAI _:
                    return(ExtVehicleType.PassengerCar);

                case AmbulanceAI _:
                case FireTruckAI _:
                case PoliceCarAI _:
                case HearseAI _:
                case GarbageTruckAI _:
                case MaintenanceTruckAI _:
                case SnowTruckAI _:
                case WaterTruckAI _:
                case DisasterResponseVehicleAI _:
                case ParkMaintenanceVehicleAI _:
                case PostVanAI _:
                    return(ExtVehicleType.Service);

                case CarTrailerAI _:
                    return(ExtVehicleType.None);

                case BusAI _:
                    return(ExtVehicleType.Bus);

                case TaxiAI _:
                    return(ExtVehicleType.Taxi);

                case CargoTruckAI _:
                    return(ExtVehicleType.CargoTruck);
                }

                break;
            }

            case VehicleInfo.VehicleType.Metro:
            case VehicleInfo.VehicleType.Train:
            case VehicleInfo.VehicleType.Monorail: {
                return(ai is CargoTrainAI
                               ? ExtVehicleType.CargoTrain
                               : ExtVehicleType.PassengerTrain);
            }

            case VehicleInfo.VehicleType.Tram: {
                return(ExtVehicleType.Tram);
            }

            case VehicleInfo.VehicleType.Ship: {
                return(ai is PassengerShipAI
                               ? ExtVehicleType.PassengerShip
                               : ExtVehicleType.CargoShip);
            }

            case VehicleInfo.VehicleType.Plane: {
                switch (ai)
                {
                case PassengerPlaneAI _:
                    return(ExtVehicleType.PassengerPlane);

                case CargoPlaneAI _:
                    return(ExtVehicleType.CargoPlane);
                }

                break;
            }

            case VehicleInfo.VehicleType.Helicopter: {
                return(ExtVehicleType.Helicopter);
            }

            case VehicleInfo.VehicleType.Ferry: {
                return(ExtVehicleType.Ferry);
            }

            case VehicleInfo.VehicleType.Blimp: {
                return(ExtVehicleType.Blimp);
            }

            case VehicleInfo.VehicleType.CableCar: {
                return(ExtVehicleType.CableCar);
            }

            case VehicleInfo.VehicleType.Trolleybus: {
                return(ExtVehicleType.Trolleybus);
            }
            }

#if DEBUGVSTATE
            Log._Debug(
                $"ExtVehicleManager.DetermineVehicleType({vehicleId}): Could not determine " +
                $"vehicle type from ai type: {ai.GetType()}");
#endif
            return(null);
        }
Ejemplo n.º 7
0
        private ExtVehicleType?DetermineVehicleTypeFromAIType(VehicleAI ai, bool emergencyOnDuty)
        {
            if (emergencyOnDuty)
            {
                return(ExtVehicleType.Emergency);
            }

            switch (ai.m_info.m_vehicleType)
            {
            case VehicleInfo.VehicleType.Bicycle:
                return(ExtVehicleType.Bicycle);

            case VehicleInfo.VehicleType.Car:
                if (ai is PassengerCarAI)
                {
                    return(ExtVehicleType.PassengerCar);
                }
                if (ai is AmbulanceAI || ai is FireTruckAI || ai is PoliceCarAI || ai is HearseAI || ai is GarbageTruckAI || ai is MaintenanceTruckAI || ai is SnowTruckAI || ai is WaterTruckAI || ai is DisasterResponseVehicleAI)
                {
                    return(ExtVehicleType.Service);
                }
                if (ai is CarTrailerAI)
                {
                    return(ExtVehicleType.None);
                }
                if (ai is BusAI)
                {
                    return(ExtVehicleType.Bus);
                }
                if (ai is TaxiAI)
                {
                    return(ExtVehicleType.Taxi);
                }
                if (ai is CargoTruckAI)
                {
                    return(ExtVehicleType.CargoTruck);
                }
                break;

            case VehicleInfo.VehicleType.Metro:
            case VehicleInfo.VehicleType.Train:
            case VehicleInfo.VehicleType.Monorail:
                if (ai is CargoTrainAI)
                {
                    return(ExtVehicleType.CargoTrain);
                }
                return(ExtVehicleType.PassengerTrain);

            case VehicleInfo.VehicleType.Tram:
                return(ExtVehicleType.Tram);

            case VehicleInfo.VehicleType.Ship:
                if (ai is PassengerShipAI)
                {
                    return(ExtVehicleType.PassengerShip);
                }
                //if (ai is CargoShipAI)
                return(ExtVehicleType.CargoShip);

            //break;
            case VehicleInfo.VehicleType.Plane:
                //if (ai is PassengerPlaneAI)
                return(ExtVehicleType.PassengerPlane);

            //break;
            case VehicleInfo.VehicleType.Helicopter:
                //if (ai is PassengerPlaneAI)
                return(ExtVehicleType.Helicopter);

            //break;
            case VehicleInfo.VehicleType.Ferry:
                return(ExtVehicleType.Ferry);

            case VehicleInfo.VehicleType.Blimp:
                return(ExtVehicleType.Blimp);

            case VehicleInfo.VehicleType.CableCar:
                return(ExtVehicleType.CableCar);
            }
#if DEBUGVSTATE
            Log._Debug($"VehicleState.DetermineVehicleType({vehicleId}): Could not determine vehicle type from ai type: {ai.GetType().ToString()}");
#endif
            return(null);
        }