本文整理汇总了C#中Vehicle类的典型用法代码示例。如果您正苦于以下问题:C# Vehicle类的具体用法?C# Vehicle怎么用?C# Vehicle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vehicle类属于命名空间,在下文中一共展示了Vehicle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WhenAddingReminder_ThenUpdatesServiceReminder
public void WhenAddingReminder_ThenUpdatesServiceReminder()
{
const int newReminderId = 456;
var vehicle = new Vehicle { VehicleId = DefaultVehicleId, Name = "vehicle" };
_vehicleRepository
.Setup(r => r.GetVehicle(DefaultUserId, DefaultVehicleId))
.Returns(vehicle);
_reminderRepository
.Setup(r => r.Create(DefaultVehicleId, It.IsAny<Reminder>()))
.Callback(new Action<int, Reminder>((vehicleId, reminder) =>
{
// represents the entity created internally
reminder.ReminderId = newReminderId;
reminder.VehicleId = DefaultVehicleId;
}));
var formModel = new ReminderFormModel();
var handler = new AddReminderToVehicle(_vehicleRepository.Object, _reminderRepository.Object);
handler.Execute(DefaultUserId, DefaultVehicleId, formModel);
Assert.Equal(newReminderId, formModel.ReminderId);
Assert.Equal(DefaultVehicleId, formModel.VehicleId);
}
开发者ID:srihari-sridharan,项目名称:Programming-Playground,代码行数:27,代码来源:WhenAddingReminder.cs
示例2: SimulationStep
public override void SimulationStep(ushort vehicleID, ref Vehicle vehicleData, ref Vehicle.Frame frameData, ushort leaderID, ref Vehicle leaderData, int lodPhysics)
{
if ((CSLTraffic.Options & OptionsManager.ModOptions.UseRealisticSpeeds) == OptionsManager.ModOptions.UseRealisticSpeeds)
{
if (CustomCarAI.sm_speedData[vehicleID].speedMultiplier == 0 || CustomCarAI.sm_speedData[vehicleID].currentPath != vehicleData.m_path)
{
CustomCarAI.sm_speedData[vehicleID].currentPath = vehicleData.m_path;
CustomCarAI.sm_speedData[vehicleID].SetRandomSpeedMultiplier(0.65f, 1.05f);
}
CustomCarAI.sm_speedData[vehicleID].ApplySpeedMultiplier(this.m_info);
}
if ((vehicleData.m_flags & Vehicle.Flags.Stopped) != Vehicle.Flags.None)
{
vehicleData.m_waitCounter += 1;
if (this.CanLeave(vehicleID, ref vehicleData))
{
vehicleData.m_flags &= ~Vehicle.Flags.Stopped;
vehicleData.m_flags |= Vehicle.Flags.Leaving;
vehicleData.m_waitCounter = 0;
}
}
CustomCarAI.SimulationStep(this, vehicleID, ref vehicleData, ref frameData, leaderID, ref leaderData, lodPhysics);
if ((vehicleData.m_flags & Vehicle.Flags.GoingBack) == Vehicle.Flags.None && this.ShouldReturnToSource(vehicleID, ref vehicleData))
{
this.SetTransportLine(vehicleID, ref vehicleData, 0);
}
if ((CSLTraffic.Options & OptionsManager.ModOptions.UseRealisticSpeeds) == OptionsManager.ModOptions.UseRealisticSpeeds)
{
CustomCarAI.sm_speedData[vehicleID].RestoreVehicleSpeed(this.m_info);
}
}
开发者ID:Rovanion,项目名称:csl-traffic,代码行数:33,代码来源:CustomBusAI.cs
示例3: CockpitView
public CockpitView(Vehicle vehicle, string cockpitFile)
{
_vehicle = vehicle;
if (GameVars.Emulation == EmulationMode.Demo)
cockpitFile = Path.GetDirectoryName(cockpitFile) + "\\blkeagle.txt";
else if (GameVars.Emulation == EmulationMode.SplatPackDemo)
cockpitFile = Path.GetDirectoryName(cockpitFile) + "\\neweagle.txt";
else if (!File.Exists(cockpitFile))
cockpitFile = Path.GetDirectoryName(cockpitFile) + "\\blkeagle.txt";
if (File.Exists(cockpitFile))
{
_cockpitFile = new CockpitFile(cockpitFile);
ActFile actFile = new ActFile(vehicle.Config.BonnetActorFile);
if (!actFile.Exists)
actFile = new ActFile("EBONNET.ACT");
_actors = actFile.Hierarchy;
DatFile modelsFile = new DatFile(_actors.Root.ModelName);
_actors.AttachModels(modelsFile.Models);
_actors.ResolveTransforms(false, null);
//move head back
_vehicle.Config.DriverHeadPosition.Z += 0.11f;
}
_camera = new SimpleCamera();
_camera.FieldOfView = MathHelper.ToRadians(55.55f);
}
开发者ID:sikora507,项目名称:OpenC1,代码行数:29,代码来源:CockpitView.cs
示例4: SimulationStep
public override void SimulationStep(ushort vehicleID, ref Vehicle data, Vector3 physicsLodRefPos)
{
var bc = blockCounter[vehicleID];
if (data.m_blockCounter == 0)
{
bc = 0;
}
else if (data.m_blockCounter > 1)
{
bc = (byte)Mathf.Min(bc + 1, 0xff);
}
if ((data.m_flags & Vehicle.Flags.Congestion) != Vehicle.Flags.None)
{
bc = (byte)Mathf.Min(bc + 5, 0xff);
data.m_flags &= ~Vehicle.Flags.Congestion;
}
data.m_blockCounter = 1;
blockCounter[vehicleID] = bc;
if (bc == 0xff)
{
blockCounter[vehicleID] = 0;
Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleID);
}
else
{
base.SimulationStep(vehicleID, ref data, physicsLodRefPos);
}
}
开发者ID:Knighth,项目名称:Cities-Skyline-Proper-Hardness,代码行数:29,代码来源:WBCargoTruckAI.cs
示例5: OnBeforeCalloutDisplayed
private LHandle pursuit; // an API pursuit handle
/// <summary>
/// OnBeforeCalloutDisplayed is where we create a blip for the user to see where the pursuit is happening, we initiliaize any variables above and set
/// the callout message and position for the API to display
/// </summary>
/// <returns></returns>
public override bool OnBeforeCalloutDisplayed()
{
//Set our spawn point to be on a street around 300f (distance) away from the player.
SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(300f));
//Create our ped in the world
myPed = new Ped("a_m_y_mexthug_01", SpawnPoint, 0f);
//Create the vehicle for our ped
myVehicle = new Vehicle("DUKES2", SpawnPoint);
//Now we have spawned them, check they actually exist and if not return false (preventing the callout from being accepted and aborting it)
if (!myPed.Exists()) return false;
if (!myVehicle.Exists()) return false;
//If we made it this far both exist so let's warp the ped into the driver seat
myPed.WarpIntoVehicle(myVehicle, -1);
// Show the user where the pursuit is about to happen and block very close peds.
this.ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 15f);
this.AddMinimumDistanceCheck(5f, myPed.Position);
// Set up our callout message and location
this.CalloutMessage = "Example Callout Message";
this.CalloutPosition = SpawnPoint;
//Play the police scanner audio for this callout (available as of the 0.2a API)
Functions.PlayScannerAudioUsingPosition("CITIZENS_REPORT CRIME_RESIST_ARREST IN_OR_ON_POSITION", SpawnPoint);
return base.OnBeforeCalloutDisplayed();
}
开发者ID:alexguirre,项目名称:LSPDFR-API,代码行数:38,代码来源:ChaseCallout.cs
示例6: Calculate
/// <summary>
/// Calculcates the metrics.
/// </summary>
/// <param name="vehicle"></param>
/// <param name="p"></param>
/// <returns></returns>
public override Dictionary<string, double> Calculate(Vehicle vehicle, AggregatedPoint p)
{
Dictionary<string, double> result = new Dictionary<string, double>();
result.Add(DISTANCE_KEY, 0);
result.Add(TIME_KEY, 0);
Aggregated next = p;
while (next != null)
{
if (next is AggregatedPoint)
{
AggregatedPoint point = (next as AggregatedPoint);
this.CalculatePointMetrics(vehicle, result, point);
}
if (next is AggregatedArc)
{
AggregatedArc arc = (next as AggregatedArc);
this.CalculateArcMetrics(vehicle, result, arc);
}
next = next.GetNext();
}
return result;
}
开发者ID:cmberryau,项目名称:routing,代码行数:31,代码来源:TimeCalculator.cs
示例7: SimulationStep
public override void SimulationStep(ushort vehicleID, ref Vehicle data, Vector3 physicsLodRefPos)
{
// Logger.dbgLog("called .");
byte bc = blockCounter[vehicleID];
if (data.m_blockCounter == 0)
{
bc = 0;
blockCounter[vehicleID] = 0;
}
else if (data.m_blockCounter > 1)
{
bc = (byte)Mathf.Min(bc + 1, 255);
WBResidentAI6.AddCommuteWait(data, 1);
}
if ((data.m_flags & Vehicle.Flags.Congestion) != Vehicle.Flags.None)
{
bc = (byte)Mathf.Min(bc + 5, 255);
data.m_flags &= ~Vehicle.Flags.Congestion;
}
data.m_blockCounter = 1;
blockCounter[vehicleID] = bc;
if (bc == 255)
{
blockCounter[vehicleID] = 0;
Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleID);
}
else
{
base.SimulationStep(vehicleID, ref data, physicsLodRefPos);
}
}
开发者ID:Knighth,项目名称:Cities-Skyline-Proper-Hardness,代码行数:35,代码来源:WBPassengerCarAI.cs
示例8: DrawContainerFront
private void DrawContainerFront(Canvas canvas, Container container, Vehicle currentVehicle)
{
var length = container.Width/Scale;
var height = container.Length/Scale;
var x = container.FirstPoint.X/Scale;
var z = (container.FirstPoint.Y - currentVehicle.FirstPoint.Y)/Scale;
var r = new Rectangle();
r.Width = length;
r.Height = height;
Brush brush = new SolidColorBrush();
brush = Brushes.White;
r.Stroke = new SolidColorBrush(Colors.Black);
r.Fill = brush;
Canvas.SetLeft(r, x);
Canvas.SetTop(r, z);
canvas.Children.Add(r);
var t = new TextBlock();
t.Text = Math.Round(container.Mass) + " кг";
t.FontSize = 12;
Canvas.SetLeft(t, x + 2);
var delta = 2;
Canvas.SetTop(t, z + 2);
canvas.Children.Add(t);
t = new TextBlock {Text = container.ShortName, FontSize = 12};
Canvas.SetLeft(t, x + 2);
delta = delta + 15;
Canvas.SetTop(t, z + delta);
canvas.Children.Add(t);
}
开发者ID:RadSt,项目名称:WPF-App-For-Ref,代码行数:35,代码来源:Calculation2D.cs
示例9: SimulationStep
public override void SimulationStep(ushort vehicleID, ref Vehicle vehicleData, ref Vehicle.Frame frameData, ushort leaderID, ref Vehicle leaderData, int lodPhysics)
{
if ((TrafficMod.Options & OptionsManager.ModOptions.UseRealisticSpeeds) == OptionsManager.ModOptions.UseRealisticSpeeds)
{
var speedData = CarSpeedData.Of(vehicleID);
if (speedData.SpeedMultiplier == 0 || speedData.CurrentPath != vehicleData.m_path)
{
speedData.CurrentPath = vehicleData.m_path;
speedData.SetRandomSpeedMultiplier(0.7f, 1.15f);
}
m_info.ApplySpeedMultiplier(CarSpeedData.Of(vehicleID));
}
base.SimulationStep(vehicleID, ref vehicleData, ref frameData, leaderID, ref leaderData, lodPhysics);
if ((vehicleData.m_flags & Vehicle.Flags.Stopped) != 0 && this.CanLeave(vehicleID, ref vehicleData))
{
vehicleData.m_flags &= ~Vehicle.Flags.Stopped;
vehicleData.m_flags |= Vehicle.Flags.Leaving;
}
if ((vehicleData.m_flags & (Vehicle.Flags.TransferToSource | Vehicle.Flags.GoingBack)) == Vehicle.Flags.TransferToSource && this.ShouldReturnToSource(vehicleID, ref vehicleData))
{
this.SetTarget(vehicleID, ref vehicleData, 0);
}
if ((TrafficMod.Options & OptionsManager.ModOptions.UseRealisticSpeeds) == OptionsManager.ModOptions.UseRealisticSpeeds)
{
m_info.RestoreVehicleSpeed(CarSpeedData.Of(vehicleID));
}
}
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:30,代码来源:CustomHearseAI.cs
示例10: CalculateTargetSpeed
protected override float CalculateTargetSpeed(ushort vehicleID, ref Vehicle data, float speedLimit, float curve)
{
if ((data.m_flags & Vehicle.Flags.Emergency2) == Vehicle.Flags.None)
return base.CalculateTargetSpeed(vehicleID, ref data, speedLimit, curve);
return Mathf.Min(base.CalculateTargetSpeed(vehicleID, ref data, speedLimit * 2, curve * 0.5f), m_info.m_maxSpeed * 2);
}
开发者ID:Jeihun,项目名称:SlowSpeed,代码行数:7,代码来源:FastPoliceCarAI.cs
示例11: DrawContainerUp
private void DrawContainerUp(Canvas canvas, Container container, Vehicle currentVehicle)
{
var length = container.Width/Scale;
var height = container.Height/Scale;
var x = (container.FirstPoint.X - currentVehicle.FirstPoint.X)/Scale;
var z = container.FirstPoint.Z/Scale;
var rectangle = new Rectangle();
rectangle.Width = length;
rectangle.Height = height;
Brush brush = new SolidColorBrush();
brush = Brushes.White;
rectangle.Stroke = new SolidColorBrush(Colors.Black);
rectangle.Fill = brush;
Canvas.SetLeft(rectangle, x);
Canvas.SetTop(rectangle, canvas.Height - height - z);
canvas.Children.Add(rectangle);
var textBlock = new TextBlock {Text = Math.Round(container.Mass) + " кг", FontSize = 12};
Canvas.SetLeft(textBlock, x + 2);
var delta = 2;
Canvas.SetTop(textBlock, canvas.Height - height - z + 2);
canvas.Children.Add(textBlock);
textBlock = new TextBlock {Text = container.ShortName, FontSize = 12};
Canvas.SetLeft(textBlock, x + 2);
delta = delta + 15;
Canvas.SetTop(textBlock, canvas.Height - height - z + delta);
canvas.Children.Add(textBlock);
}
开发者ID:RadSt,项目名称:WPF-App-For-Ref,代码行数:31,代码来源:Calculation2D.cs
示例12: ArriveAtTarget
private bool ArriveAtTarget(ushort vehicleID, ref Vehicle data)
{
VehicleManager instance = Singleton<VehicleManager>.instance;
ushort num = data.m_firstCargo;
data.m_firstCargo = 0;
int num2 = 0;
while (num != 0)
{
ushort nextCargo = instance.m_vehicles.m_buffer [(int)num].m_nextCargo;
instance.m_vehicles.m_buffer [(int)num].m_nextCargo = 0;
instance.m_vehicles.m_buffer [(int)num].m_cargoParent = 0;
VehicleInfo info = instance.m_vehicles.m_buffer [(int)num].Info;
if (data.m_targetBuilding != 0)
{
info.m_vehicleAI.SetSource (num, ref instance.m_vehicles.m_buffer [(int)num], data.m_targetBuilding);
info.m_vehicleAI.SetTarget (num, ref instance.m_vehicles.m_buffer [(int)num], instance.m_vehicles.m_buffer [(int)num].m_targetBuilding);
}
num = nextCargo;
if (++num2 > 65536)
{
CODebugBase<LogChannel>.Error (LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
break;
}
}
data.m_waitCounter = 0;
data.m_flags |= Vehicle.Flags.WaitingLoading;
return false;
}
开发者ID:klyte45,项目名称:CS-VehicleLimitExpander,代码行数:28,代码来源:FakeCargoShipAI.cs
示例13: Operator
Operator IOperatorProfile.GetOperator(string operatorName, string trafficFileNumber)
{
Operator operatorFormWeb = new Operator();
try
{
handHeldService.HandHeldService service = new VSDApp.handHeldService.HandHeldService();
handHeldService.AuthHeader authorize = new VSDApp.handHeldService.AuthHeader();
authorize.password = AppProperties.empPassword;
authorize.userName = AppProperties.empUserName;
service.authHeader = authorize;
handHeldService.InquireCompanyProfileResponseItem responseItem = new VSDApp.handHeldService.InquireCompanyProfileResponseItem();
operatorFormWeb = new Operator();
responseItem = service.inquireCompanyProfile("H-PS-ICP-1", trafficFileNumber, null);
if (responseItem.response.code.Equals("1000", StringComparison.CurrentCultureIgnoreCase))
{
operatorFormWeb.OperatorOVRRScore = responseItem.company.riskRating.riskRatingName;
operatorFormWeb.OperatorName = responseItem.company.ownerName;
operatorFormWeb.OperatorNameAr = responseItem.company.ownerNameArabic;
operatorFormWeb.TrafficFileNumber = responseItem.company.trafficFileNumber;
Vehicle[] copyResponseVehicles = new Vehicle[responseItem.company.vehicles.Length];
int count = 0;
foreach (handHeldService.Vehicle responseVehicles in responseItem.company.vehicles)
{
copyResponseVehicles[count] = new Vehicle();
copyResponseVehicles[count].RiskRating = responseVehicles.riskRating.riskRatingName;
copyResponseVehicles[count].PlateNumber = responseVehicles.plateDetails.number;
copyResponseVehicles[count].PlateCode = responseVehicles.plateDetails.code;
copyResponseVehicles[count].PlateCategory = responseVehicles.plateDetails.category;
copyResponseVehicles[count].Emirate = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateEmirate(responseVehicles.plateDetails.source);
copyResponseVehicles[count].PlateSource = responseVehicles.plateDetails.source;
count++;
}
operatorFormWeb.TopViolatingVehicles = copyResponseVehicles;
}
else if (responseItem.response.code.Equals("2000"))
{
AppProperties.businessError = true;
AppProperties.errorMessageFromBusiness = responseItem.response.message;
}
else
{
AppProperties.NotFoundError = true;
AppProperties.errorMessageFromBusiness = responseItem.response.message;
// System.Windows.Forms.MessageBox.Show(responseItem.response.message);
return null;
}
}
catch (Exception ex)
{
AppProperties.IsException = true;
AppProperties.errorMessageFromBusiness = ex.InnerException.Message;
CommonUtils.WriteLog(ex.StackTrace);
return null;
}
return operatorFormWeb;
}
开发者ID:juniiikhan,项目名称:VDCS,代码行数:60,代码来源:OperatorProfileManager.cs
示例14: Start
public void Start(Vehicle vechicle)
{
// Send details to Administrator
// Print
Console.WriteLine("Race Vehicle started, Name : {0} | Model : {1} | Driver : {2}", vechicle.Name, vechicle.Model, vechicle.DriverName);
}
开发者ID:jayakaran1987,项目名称:Multithreading-with-.NET,代码行数:7,代码来源:RaceService.cs
示例15: TrafficManagerSimulationStep
/// <summary>
/// Lightweight simulation step method.
/// This method is occasionally being called for different cars.
/// </summary>
/// <param name="vehicleId"></param>
/// <param name="vehicleData"></param>
/// <param name="physicsLodRefPos"></param>
public void TrafficManagerSimulationStep(ushort vehicleId, ref Vehicle vehicleData, Vector3 physicsLodRefPos) {
if ((vehicleData.m_flags & Vehicle.Flags.WaitingPath) != 0) {
PathManager instance = Singleton<PathManager>.instance;
byte pathFindFlags = instance.m_pathUnits.m_buffer[(int)((UIntPtr)vehicleData.m_path)].m_pathFindFlags;
if ((pathFindFlags & 4) != 0) {
vehicleData.m_pathPositionIndex = 255;
vehicleData.m_flags &= ~Vehicle.Flags.WaitingPath;
vehicleData.m_flags &= ~Vehicle.Flags.Arriving;
this.PathfindSuccess(vehicleId, ref vehicleData);
this.TrySpawn(vehicleId, ref vehicleData);
} else if ((pathFindFlags & 8) != 0) {
vehicleData.m_flags &= ~Vehicle.Flags.WaitingPath;
Singleton<PathManager>.instance.ReleasePath(vehicleData.m_path);
vehicleData.m_path = 0u;
this.PathfindFailure(vehicleId, ref vehicleData);
return;
}
} else if ((vehicleData.m_flags & Vehicle.Flags.WaitingSpace) != 0) {
this.TrySpawn(vehicleId, ref vehicleData);
}
try {
CustomVehicleAI.HandleVehicle(vehicleId, ref Singleton<VehicleManager>.instance.m_vehicles.m_buffer[vehicleId], true, true);
} catch (Exception e) {
Log.Error("CarAI TrafficManagerSimulationStep Error: " + e.ToString());
}
Vector3 lastFramePosition = vehicleData.GetLastFramePosition();
int lodPhysics;
if (Vector3.SqrMagnitude(physicsLodRefPos - lastFramePosition) >= 1210000f) {
lodPhysics = 2;
} else if (Vector3.SqrMagnitude(Singleton<SimulationManager>.instance.m_simulationView.m_position - lastFramePosition) >= 250000f) {
lodPhysics = 1;
} else {
lodPhysics = 0;
}
this.SimulationStep(vehicleId, ref vehicleData, vehicleId, ref vehicleData, lodPhysics);
if (vehicleData.m_leadingVehicle == 0 && vehicleData.m_trailingVehicle != 0) {
VehicleManager instance2 = Singleton<VehicleManager>.instance;
ushort num = vehicleData.m_trailingVehicle;
int num2 = 0;
while (num != 0) {
ushort trailingVehicle = instance2.m_vehicles.m_buffer[(int)num].m_trailingVehicle;
VehicleInfo info = instance2.m_vehicles.m_buffer[(int)num].Info;
info.m_vehicleAI.SimulationStep(num, ref instance2.m_vehicles.m_buffer[(int)num], vehicleId, ref vehicleData, lodPhysics);
num = trailingVehicle;
if (++num2 > 16384) {
CODebugBase<LogChannel>.Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
break;
}
}
}
int privateServiceIndex = ItemClass.GetPrivateServiceIndex(this.m_info.m_class.m_service);
int num3 = (privateServiceIndex == -1) ? 150 : 100;
if ((vehicleData.m_flags & (Vehicle.Flags.Spawned | Vehicle.Flags.WaitingPath | Vehicle.Flags.WaitingSpace)) == 0 && vehicleData.m_cargoParent == 0) {
Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleId);
} else if ((int)vehicleData.m_blockCounter == num3 && Options.enableDespawning) {
Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleId);
}
}
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:67,代码来源:CustomCarAI.cs
示例16: StartPathFind
protected override bool StartPathFind(ushort vehicleID, ref Vehicle vehicleData)
{
if ((vehicleData.m_flags & Vehicle.Flags.WaitingTarget) != 0)
{
return true;
}
if ((vehicleData.m_flags & Vehicle.Flags.GoingBack) != 0)
{
if (vehicleData.m_sourceBuilding != 0)
{
BuildingManager instance = Singleton<BuildingManager>.instance;
BuildingInfo info = instance.m_buildings.m_buffer[(int)vehicleData.m_sourceBuilding].Info;
Randomizer randomizer = new Randomizer((int)vehicleID);
Vector3 vector;
Vector3 endPos;
info.m_buildingAI.CalculateUnspawnPosition(vehicleData.m_sourceBuilding, ref instance.m_buildings.m_buffer[(int)vehicleData.m_sourceBuilding], ref randomizer, this.m_info, out vector, out endPos);
return this.StartPathFind(ExtendedVehicleType.Hearse, vehicleID, ref vehicleData, vehicleData.m_targetPos3, endPos, IsHeavyVehicle(), IgnoreBlocked(vehicleID, ref vehicleData));
}
}
else if (vehicleData.m_targetBuilding != 0)
{
BuildingManager instance2 = Singleton<BuildingManager>.instance;
BuildingInfo info2 = instance2.m_buildings.m_buffer[(int)vehicleData.m_targetBuilding].Info;
Randomizer randomizer2 = new Randomizer((int)vehicleID);
Vector3 vector2;
Vector3 endPos2;
info2.m_buildingAI.CalculateUnspawnPosition(vehicleData.m_targetBuilding, ref instance2.m_buildings.m_buffer[(int)vehicleData.m_targetBuilding], ref randomizer2, this.m_info, out vector2, out endPos2);
return this.StartPathFind(ExtendedVehicleType.Hearse, vehicleID, ref vehicleData, vehicleData.m_targetPos3, endPos2, IsHeavyVehicle(), IgnoreBlocked(vehicleID, ref vehicleData));
}
return false;
}
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:31,代码来源:CustomHearseAI.cs
示例17: RemoveVehicle
public void RemoveVehicle(ushort vehicleID, ref Vehicle data)
{
VehicleManager instance = Singleton<VehicleManager>.instance;
ushort num = 0;
ushort num2 = this.m_vehicles;
int num3 = 0;
while (num2 != 0) {
if (num2 == vehicleID) {
if (num != 0) {
instance.m_vehicles.m_buffer [(int)num].m_nextLineVehicle = data.m_nextLineVehicle;
} else {
this.m_vehicles = data.m_nextLineVehicle;
}
data.m_nextLineVehicle = 0;
data.m_targetBuilding = 0;
return;
}
num = num2;
num2 = instance.m_vehicles.m_buffer [(int)num2].m_nextLineVehicle;
if (++num3 > 65536) {
CODebugBase<LogChannel>.Error (LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
break;
}
}
}
开发者ID:klyte45,项目名称:CS-VehicleLimitExpander,代码行数:25,代码来源:FakeTransportLine.cs
示例18: CHEdgeGraphFileStreamTarget
/// <summary>
/// Creates a new target.
/// </summary>
/// <param name="stream"></param>
/// <param name="dynamicGraph"></param>
/// <param name="interpreter"></param>
/// <param name="tagsIndex"></param>
/// <param name="vehicle"></param>
public CHEdgeGraphFileStreamTarget(Stream stream, DynamicGraphRouterDataSource<CHEdgeData> dynamicGraph,
IOsmRoutingInterpreter interpreter, ITagsCollectionIndex tagsIndex, Vehicle vehicle)
: base(dynamicGraph, interpreter, tagsIndex, vehicle)
{
_graph = dynamicGraph;
_graphStream = stream;
}
开发者ID:kochizufan,项目名称:OsmSharp,代码行数:15,代码来源:CHEdgeGraphFileStreamTarget.cs
示例19: GetData
public static Vehicle[] GetData()
{
Int32 unixTimestamp = (Int32)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
double latMin = 55.2;
double lonMin = 8.1;
double latMax = 56.7;
double lonMax = 12.6;
double latStep = (latMax - latMin) / stationsCount;
double lonStep = (lonMax - lonMin) / stationsCount;
Vehicle[] vehicles = new Vehicle[stationsCount];
for (int i = 0; i < stationsCount; i++)
{
string trainType = trainTypes[rnd.Next(0, 10)];
int delay = rnd.Next(0, 15);
double lat = latMin + latStep * i;
double lon = lonMin + lonStep * i;
double alt = rnd.NextDouble() * (40 - 20) + 20;
int speed = rnd.Next(0, 140);
speed = speed < 9 ? 0 : speed;
double direction = rnd.NextDouble() * 360;
int weight = rnd.Next(1, 90);
vehicles[i] = new Vehicle("ab100" + i.ToString(), trainType, stations[i], "e", delay, Math.Round(lat, 6), Math.Round(lon, 6), Math.Round(alt, 1), speed, Math.Round(direction, 1), weight, unixTimestamp);
}
return vehicles;
}
开发者ID:vyrcoop,项目名称:TrainSurfing,代码行数:30,代码来源:DSBTrainData.cs
示例20: GetDriverInstance2
public static ushort GetDriverInstance2(ushort vehicleID, ref Vehicle data)
{
CitizenManager instance = Singleton<CitizenManager>.instance;
uint num = data.m_citizenUnits;
int num2 = 0;
while (num != 0u)
{
uint nextUnit = instance.m_units.m_buffer[(int)((UIntPtr)num)].m_nextUnit;
for (int i = 0; i < 5; i++)
{
uint citizen = instance.m_units.m_buffer[(int)((UIntPtr)num)].GetCitizen(i);
if (citizen != 0u)
{
ushort instance2 = instance.m_citizens.m_buffer[(int)((UIntPtr)citizen)].m_instance;
if (instance2 != 0)
{
return instance2;
}
}
}
num = nextUnit;
if (++num2 > 524288)
{
CODebugBase<LogChannel>.Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
break;
}
}
return 0;
}
开发者ID:lyming531,项目名称:Skylines-Traffic-Manager,代码行数:29,代码来源:CustomPassengerCarAI.cs
注:本文中的Vehicle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论