当前位置: 首页>>代码示例>>C#>>正文


C# Vehicle.Unspawn方法代码示例

本文整理汇总了C#中Vehicle.Unspawn方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.Unspawn方法的具体用法?C# Vehicle.Unspawn怎么用?C# Vehicle.Unspawn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vehicle的用法示例。


在下文中一共展示了Vehicle.Unspawn方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CustomSimulationStep

        public void CustomSimulationStep(ushort vehicleId, ref Vehicle data, Vector3 physicsLodRefPos)
        {
			try {
				if ((data.m_flags & Vehicle.Flags.Congestion) != 0 && Options.enableDespawning) {
					Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleId);
				} else {
					if ((data.m_flags & Vehicle.Flags.WaitingTarget) != 0 && (data.m_waitCounter += 1) > 20) {
						RemoveOffers(vehicleId, ref data);
						data.m_flags &= ~Vehicle.Flags.WaitingTarget;
						data.m_flags |= Vehicle.Flags.GoingBack;
						data.m_waitCounter = 0;
						if (!StartPathFind(vehicleId, ref data)) {
							data.Unspawn(vehicleId);
						}
					}

					if (Options.simAccuracy <= 1) {
						try {
							CustomVehicleAI.HandleVehicle(vehicleId, ref Singleton<VehicleManager>.instance.m_vehicles.m_buffer[vehicleId], true, true);
						} catch (Exception e) {
							Log.Error("CargoTruckAI CustomSimulationStep Error: " + e.ToString());
						}
					}

					BaseSimulationStep(vehicleId, ref data, physicsLodRefPos);
				}
			} catch (Exception ex) {
				Log.Error("Error in CargoTruckAI.SimulationStep: " + ex.ToString());
			}
        }
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:30,代码来源:CustomCargoTruckAI.cs

示例2: SimulationStep

 public override void SimulationStep(ushort vehicleID, ref Vehicle data, Vector3 physicsLodRefPos)
 {
     if ((data.m_flags & Vehicle.Flags.WaitingPath) != Vehicle.Flags.None) {
         PathManager instance = Singleton<PathManager>.instance;
         byte pathFindFlags = instance.m_pathUnits.m_buffer [(int)((UIntPtr)data.m_path)].m_pathFindFlags;
         if ((pathFindFlags & 4) != 0) {
             data.m_pathPositionIndex = 255;
             data.m_flags &= ~Vehicle.Flags.WaitingPath;
             this.TrySpawn (vehicleID, ref data);
         } else {
             if ((pathFindFlags & 8) != 0) {
                 data.m_flags &= ~Vehicle.Flags.WaitingPath;
                 Singleton<PathManager>.instance.ReleasePath (data.m_path);
                 data.m_path = 0u;
                 data.Unspawn (vehicleID);
                 return;
             }
         }
     } else {
         if ((data.m_flags & Vehicle.Flags.WaitingSpace) != Vehicle.Flags.None) {
             this.TrySpawn (vehicleID, ref data);
         }
     }
     this.SimulationStep (vehicleID, ref data, vehicleID, ref data, 0);
     if (data.m_leadingVehicle == 0 && data.m_trailingVehicle != 0) {
         VehicleManager instance2 = Singleton<VehicleManager>.instance;
         ushort num = data.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 data, 0);
             num = trailingVehicle;
             if (++num2 > 65536) {
                 CODebugBase<LogChannel>.Error (LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
                 break;
             }
         }
     }
     if ((data.m_flags & (Vehicle.Flags.Spawned | Vehicle.Flags.WaitingPath | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo)) == Vehicle.Flags.None || data.m_blockCounter == 255) {
         Singleton<VehicleManager>.instance.ReleaseVehicle (vehicleID);
     }
 }
开发者ID:klyte45,项目名称:CS-VehicleLimitExpander,代码行数:43,代码来源:FakeShipAI.cs

示例3: SimulationStep

        public override void SimulationStep(ushort vehicleID, ref Vehicle data, Vector3 physicsLodRefPos)
        {
            if ((TrafficMod.Options & OptionsManager.ModOptions.UseRealisticSpeeds) == OptionsManager.ModOptions.UseRealisticSpeeds)
            {
                var speedData = CarSpeedData.Of(vehicleID);

                if (speedData.SpeedMultiplier == 0 || speedData.CurrentPath != data.m_path)
                {
                    speedData.CurrentPath = data.m_path;
                    speedData.SetRandomSpeedMultiplier(0.7f, 1.1f);
                }
                m_info.ApplySpeedMultiplier(CarSpeedData.Of(vehicleID));
            }

            if (((data.m_flags & Vehicle.Flags.Congestion) != 0) &&
                ((TrafficMod.Options & OptionsManager.ModOptions.NoDespawn) != OptionsManager.ModOptions.NoDespawn))
            {
                Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleID);
            }
            else
            {
                if ((data.m_flags & Vehicle.Flags.WaitingTarget) != 0 && (data.m_waitCounter += 1) > 20)
                {
                    this.RemoveOffers(vehicleID, ref data);
                    data.m_flags &= ~Vehicle.Flags.WaitingTarget;
                    data.m_flags |= Vehicle.Flags.GoingBack;
                    data.m_waitCounter = 0;
                    if (!this.StartPathFind(vehicleID, ref data))
                    {
                        data.Unspawn(vehicleID);
                    }
                }
                base.SimulationStep(vehicleID, ref data, physicsLodRefPos);
            }

            if ((TrafficMod.Options & OptionsManager.ModOptions.UseRealisticSpeeds) == OptionsManager.ModOptions.UseRealisticSpeeds)
            {
                m_info.RestoreVehicleSpeed(CarSpeedData.Of(vehicleID));
            }
        }
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:40,代码来源:CustomCargoTruckAI.cs

示例4: SimulationStep

 public override void SimulationStep(ushort vehicleId, ref Vehicle data, Vector3 physicsLodRefPos)
 {
     if ((data.m_flags & Vehicle.Flags.Congestion) != Vehicle.Flags.None && LoadingExtension.Instance.DespawnEnabled)
     {
         Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleId);
     }
     else
     {
         if ((data.m_flags & Vehicle.Flags.WaitingTarget) != Vehicle.Flags.None && (data.m_waitCounter += 1) > 20)
         {
             RemoveOffers(vehicleId, ref data);
             data.m_flags &= ~Vehicle.Flags.WaitingTarget;
             data.m_flags |= Vehicle.Flags.GoingBack;
             data.m_waitCounter = 0;
             if (!StartPathFind(vehicleId, ref data))
             {
                 data.Unspawn(vehicleId);
             }
         }
         BaseSimulationStep(vehicleId, ref data, physicsLodRefPos);
     }
 }
开发者ID:oczkers,项目名称:Skylines-Traffic-Manager,代码行数:22,代码来源:CustomCargoTruckAI.cs

示例5: DeAssign

        /// <summary>
        /// Removes target assignment from vehicle.
        /// </summary>
        /// <param name="vehicleId">The vehicle identifier.</param>
        /// <param name="vehicle">The vehicle data.</param>
        /// <returns>True if vehicle de-assigned and ok.</returns>
        /// <param name="recall">If set to <c>true</c> recall vehicle to service building.</param>
        public static bool DeAssign(ushort vehicleId, ref Vehicle vehicle, bool recall = false)
        {
            try
            {
                // Vehicle has spawned but not moved, just unspawn.
                Vector3 spawnPos = GetSpawnPosition(vehicleId, vehicle.Info, vehicle.m_sourceBuilding);

                if ((vehicle.m_frame0.m_position - spawnPos).sqrMagnitude < 1 &&
                    (vehicle.m_frame1.m_position - spawnPos).sqrMagnitude < 1 &&
                    (vehicle.m_frame2.m_position - spawnPos).sqrMagnitude < 1 &&
                    (vehicle.m_frame3.m_position - spawnPos).sqrMagnitude < 1)
                {
                    Log.Debug(typeof(VehicleHelper), "DeAssign", "DeSpawn", vehicleId, vehicle, vehicle.Info.m_vehicleAI);

                    vehicle.m_flags &= ~Vehicle.Flags.WaitingSpace;
                    vehicle.m_flags &= ~Vehicle.Flags.WaitingPath;
                    vehicle.Unspawn(vehicleId);

                    return true;
                }
            }
            catch (Exception ex)
            {
                Log.Error(typeof(VehicleHelper), "DeAssign", ex);
            }

            bool targetSet = SetTarget(vehicleId, ref vehicle, 0, 0);

            if ((vehicle.m_flags & Vehicle.Flags.WaitingTarget) != ~Vehicle.Flags.All)
            {
                Global.TransferOffersCleaningNeeded = true;

                if (recall)
                {
                    if (Log.LogALot && Log.LogToFile)
                    {
                        Log.DevDebug(typeof(VehicleHelper), "DeAssign", "Recall", vehicleId, vehicle.m_targetBuilding, vehicle.m_flags);
                    }

                    vehicle.m_waitCounter = byte.MaxValue - 1;
                }
            }

            return targetSet;
        }
开发者ID:DinkyToyz,项目名称:wtmcsServiceDispatcher,代码行数:52,代码来源:VehicleHelper.cs

示例6: SimulationStep


//.........这里部分代码省略.........
             num10 = Mathf.Min(num10, CalculateMaxSpeed(num16, vehicleData.m_targetPos2.w, braking * 0.9f));
             num16 += VectorUtils.LengthXZ(vehicleData.m_targetPos2 - vehicleData.m_targetPos1);
             num10 = Mathf.Min(num10, CalculateMaxSpeed(num16, vehicleData.m_targetPos3.w, braking * 0.9f));
             num16 += VectorUtils.LengthXZ(vehicleData.m_targetPos3 - vehicleData.m_targetPos2);
             if (vehicleData.m_targetPos3.w < 0.01f)
             {
                 num16 = Mathf.Max(0f, num16 - carAI.m_info.m_generatedInfo.m_size.z * 0.5f);
             }
             num10 = Mathf.Min(num10, CalculateMaxSpeed(num16, 0f, braking * 0.9f));
             if (!DisableCollisionCheck(leaderID, ref leaderData))
             {
                 CustomCarAI.CheckOtherVehicles(carAI, vehicleID, ref vehicleData, ref frameData, ref num10, ref flag5, ref zero, num, braking * 0.9f, lodPhysics);
             }
             if (flag6)
             {
                 num10 = -num10;
             }
             if (num10 < magnitude)
             {
                 float num17 = Mathf.Max(acceleration, Mathf.Min(braking, magnitude));
                 num11 = Mathf.Max(num10, magnitude - num17);
             }
             else
             {
                 float num18 = Mathf.Max(acceleration, Mathf.Min(braking, -magnitude));
                 num11 = Mathf.Min(num10, magnitude + num18);
             }
         }
     }
     else
     {
         if (magnitude < 0.1f && flag && carAI.ArriveAtDestination(leaderID, ref leaderData))
         {
             leaderData.Unspawn(leaderID);
             if (leaderID == vehicleID)
             {
                 frameData = leaderData.m_frame0;
             }
             return;
         }
     }
     if ((leaderData.m_flags & Vehicle.Flags.Stopped) == Vehicle.Flags.None && num10 < 0.1f)
     {
         flag5 = true;
     }
     if (flag5)
     {
         vehicleData.m_blockCounter = (byte)Mathf.Min((int)(vehicleData.m_blockCounter + 1), 255);
         if ((vehicleData.m_blockCounter == 100 || vehicleData.m_blockCounter == 150) && (CSLTraffic.Options & OptionsManager.ModOptions.NoDespawn) == OptionsManager.ModOptions.NoDespawn)
             vehicleData.m_blockCounter++;
     }
     else
     {
         vehicleData.m_blockCounter = 0;
     }
     if (num13 > 1f)
     {
         num12 = Mathf.Asin(a.x) * Mathf.Sign(num11);
         vector3 = a * num11;
     }
     else
     {
         num11 = 0f;
         Vector3 b4 = Vector3.ClampMagnitude(vector * 0.5f - vector2, braking);
         vector3 = vector2 + b4;
     }
开发者ID:moverperfect,项目名称:csl-traffic,代码行数:67,代码来源:CustomCarAI.cs

示例7: SimulationStep


//.........这里部分代码省略.........
                    }
                    num16 += VectorUtils.LengthXZ(vehicleData.m_targetPos1 - vehicleData.m_targetPos0);
                    num10 = Mathf.Min(num10, CustomCarAI.CalculateMaxSpeed(num16, vehicleData.m_targetPos2.w, braking * 0.9f));
                    num16 += VectorUtils.LengthXZ(vehicleData.m_targetPos2 - vehicleData.m_targetPos1);
                    num10 = Mathf.Min(num10, CustomCarAI.CalculateMaxSpeed(num16, vehicleData.m_targetPos3.w, braking * 0.9f));
                    num16 += VectorUtils.LengthXZ(vehicleData.m_targetPos3 - vehicleData.m_targetPos2);
                    if (vehicleData.m_targetPos3.w < 0.01f)
                    {
                        num16 = Mathf.Max(0f, num16 - this.m_info.m_generatedInfo.m_size.z * 0.5f);
                    }
                    num10 = Mathf.Min(num10, CustomCarAI.CalculateMaxSpeed(num16, 0f, braking * 0.9f));
                    if (!CustomCarAI.DisableCollisionCheck(leaderID, ref leaderData))
                    {
                        this.CheckOtherVehicles(vehicleID, ref vehicleData, ref frameData, ref num10, ref flag5, ref zero, num, braking * 0.9f, lodPhysics);
                    }
                    if (flag6)
                    {
                        num10 = -num10;
                    }
                    if (num10 < magnitude)
                    {
                        float num17 = Mathf.Max(acceleration, Mathf.Min(braking, magnitude));
                        num11 = Mathf.Max(num10, magnitude - num17);
                    }
                    else
                    {
                        float num18 = Mathf.Max(acceleration, Mathf.Min(braking, -magnitude));
                        num11 = Mathf.Min(num10, magnitude + num18);
                    }
                }
            }
            else if (magnitude < 0.1f && flag && this.ArriveAtDestination(leaderID, ref leaderData))
            {
                leaderData.Unspawn(leaderID);
                if (leaderID == vehicleID)
                {
                    frameData = leaderData.m_frame0;
                }
                return;
            }
            if ((leaderData.m_flags & Vehicle.Flags.Stopped) == Vehicle.Flags.None && num10 < 0.1f)
            {
                flag5 = true;
            }
            if (flag5)
            {
                vehicleData.m_blockCounter = (byte)Mathf.Min((int)(vehicleData.m_blockCounter + 1), 255);
                if ((vehicleData.m_blockCounter == 100 || vehicleData.m_blockCounter == 150) && !LoadingExtension.Instance.despawnEnabled)
                    vehicleData.m_blockCounter++;
            }
            else
            {
                vehicleData.m_blockCounter = 0;
            }
            if (num13 > 1f)
            {
                num12 = Mathf.Asin(a.x) * Mathf.Sign(num11);
                vector3 = a * num11;
            }
            else
            {
                num11 = 0f;
                Vector3 b4 = Vector3.ClampMagnitude(vector * 0.5f - vector2, braking);
                vector3 = vector2 + b4;
            }
            bool flag7 = (currentFrameIndex + (uint)leaderID & 16u) != 0u;
开发者ID:fadster,项目名称:TrafficManager_ImprovedAI,代码行数:67,代码来源:CustomCarAI.cs

示例8: PathfindFailure

 protected virtual void PathfindFailure(ushort vehicleID, ref Vehicle data)
 {
     data.Unspawn (vehicleID);
 }
开发者ID:klyte45,项目名称:CS-VehicleLimitExpander,代码行数:4,代码来源:FakeCarAI.cs

示例9: TrafficManagerSimulationStep

		public void TrafficManagerSimulationStep(ushort vehicleId, ref Vehicle vehicleData, Vector3 physicsLodRefPos) {
			if ((vehicleData.m_flags & Vehicle.Flags.WaitingPath) != Vehicle.Flags.None) {
				byte pathFindFlags = Singleton<PathManager>.instance.m_pathUnits.m_buffer[(int)((UIntPtr)vehicleData.m_path)].m_pathFindFlags;
				if ((pathFindFlags & 4) != 0) {
					this.PathFindReady(vehicleId, ref vehicleData);
				} else if ((pathFindFlags & 8) != 0 || vehicleData.m_path == 0u) {
					vehicleData.m_flags &= ~Vehicle.Flags.WaitingPath;
					Singleton<PathManager>.instance.ReleasePath(vehicleData.m_path);
					vehicleData.m_path = 0u;
					vehicleData.Unspawn(vehicleId);
					return;
				}
			} else if ((vehicleData.m_flags & Vehicle.Flags.WaitingSpace) != Vehicle.Flags.None) {
				this.TrySpawn(vehicleId, ref vehicleData);
			}

			/// NON-STOCK CODE START ///
			try {
				CustomCarAI.HandleVehicle(vehicleId, ref Singleton<VehicleManager>.instance.m_vehicles.m_buffer[vehicleId], false, 5);
			} catch (Exception e) {
				Log.Error("TrainAI TrafficManagerSimulationStep Error: " + e.ToString());
			}
			/// NON-STOCK CODE END ///

			bool flag = (vehicleData.m_flags & Vehicle.Flags.Reversed) != Vehicle.Flags.None;
			ushort num;
			if (flag) {
				num = vehicleData.GetLastVehicle(vehicleId);
			} else {
				num = vehicleId;
			}
			VehicleManager instance = Singleton<VehicleManager>.instance;
			VehicleInfo info = instance.m_vehicles.m_buffer[(int)num].Info;
			info.m_vehicleAI.SimulationStep(num, ref instance.m_vehicles.m_buffer[(int)num], vehicleId, ref vehicleData, 0);
			if ((vehicleData.m_flags & (Vehicle.Flags.Created | Vehicle.Flags.Deleted)) != Vehicle.Flags.Created) {
				return;
			}
			bool flag2 = (vehicleData.m_flags & Vehicle.Flags.Reversed) != Vehicle.Flags.None;
			if (flag2 != flag) {
				flag = flag2;
				if (flag) {
					num = vehicleData.GetLastVehicle(vehicleId);
				} else {
					num = vehicleId;
				}
				info = instance.m_vehicles.m_buffer[(int)num].Info;
				info.m_vehicleAI.SimulationStep(num, ref instance.m_vehicles.m_buffer[(int)num], vehicleId, ref vehicleData, 0);
				if ((vehicleData.m_flags & (Vehicle.Flags.Created | Vehicle.Flags.Deleted)) != Vehicle.Flags.Created) {
					return;
				}
				flag2 = ((vehicleData.m_flags & Vehicle.Flags.Reversed) != Vehicle.Flags.None);
				if (flag2 != flag) {
					Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleId);
					return;
				}
			}
			if (flag) {
				num = instance.m_vehicles.m_buffer[(int)num].m_leadingVehicle;
				int num2 = 0;
				while (num != 0) {
					info = instance.m_vehicles.m_buffer[(int)num].Info;
					info.m_vehicleAI.SimulationStep(num, ref instance.m_vehicles.m_buffer[(int)num], vehicleId, ref vehicleData, 0);
					if ((vehicleData.m_flags & (Vehicle.Flags.Created | Vehicle.Flags.Deleted)) != Vehicle.Flags.Created) {
						return;
					}
					num = instance.m_vehicles.m_buffer[(int)num].m_leadingVehicle;
					if (++num2 > 16384) {
						CODebugBase<LogChannel>.Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
						break;
					}
				}
			} else {
				num = instance.m_vehicles.m_buffer[(int)num].m_trailingVehicle;
				int num3 = 0;
				while (num != 0) {
					info = instance.m_vehicles.m_buffer[(int)num].Info;
					info.m_vehicleAI.SimulationStep(num, ref instance.m_vehicles.m_buffer[(int)num], vehicleId, ref vehicleData, 0);
					if ((vehicleData.m_flags & (Vehicle.Flags.Created | Vehicle.Flags.Deleted)) != Vehicle.Flags.Created) {
						return;
					}
					num = instance.m_vehicles.m_buffer[(int)num].m_trailingVehicle;
					if (++num3 > 16384) {
						CODebugBase<LogChannel>.Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
						break;
					}
				}
			}
			if ((vehicleData.m_flags & (Vehicle.Flags.Spawned | Vehicle.Flags.WaitingPath | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo)) == Vehicle.Flags.None || vehicleData.m_blockCounter == 255) {
				Singleton<VehicleManager>.instance.ReleaseVehicle(vehicleId);
			}
		}
开发者ID:akira-ishizaki,项目名称:Cities-Skylines-Traffic-Manager-President-Edition,代码行数:91,代码来源:CustomTrainAI.cs

示例10: SimulationStep

 public override void SimulationStep(ushort vehicleID, ref Vehicle data, Vector3 physicsLodRefPos)
 {
     if ((data.m_flags & Vehicle.Flags.WaitingPath) != Vehicle.Flags.None) {
         byte pathFindFlags = Singleton<PathManager>.instance.m_pathUnits.m_buffer [(int)((UIntPtr)data.m_path)].m_pathFindFlags;
         if ((pathFindFlags & 4) != 0) {
             this.PathFindReady (vehicleID, ref data);
         } else {
             if ((pathFindFlags & 8) != 0 || data.m_path == 0u) {
                 data.m_flags &= ~Vehicle.Flags.WaitingPath;
                 Singleton<PathManager>.instance.ReleasePath (data.m_path);
                 data.m_path = 0u;
                 data.Unspawn (vehicleID);
                 return;
             }
         }
     } else {
         if ((data.m_flags & Vehicle.Flags.WaitingSpace) != Vehicle.Flags.None) {
             this.TrySpawn (vehicleID, ref data);
         }
     }
     bool flag = (data.m_flags & Vehicle.Flags.Reversed) != Vehicle.Flags.None;
     ushort num;
     if (flag) {
         num = data.GetLastVehicle (vehicleID);
     } else {
         num = vehicleID;
     }
     VehicleManager instance = Singleton<VehicleManager>.instance;
     VehicleInfo info = instance.m_vehicles.m_buffer [(int)num].Info;
     info.m_vehicleAI.SimulationStep (num, ref instance.m_vehicles.m_buffer [(int)num], vehicleID, ref data, 0);
     if ((data.m_flags & (Vehicle.Flags.Created | Vehicle.Flags.Deleted)) != Vehicle.Flags.Created) {
         return;
     }
     bool flag2 = (data.m_flags & Vehicle.Flags.Reversed) != Vehicle.Flags.None;
     if (flag2 != flag) {
         flag = flag2;
         if (flag) {
             num = data.GetLastVehicle (vehicleID);
         } else {
             num = vehicleID;
         }
         info = instance.m_vehicles.m_buffer [(int)num].Info;
         info.m_vehicleAI.SimulationStep (num, ref instance.m_vehicles.m_buffer [(int)num], vehicleID, ref data, 0);
         if ((data.m_flags & (Vehicle.Flags.Created | Vehicle.Flags.Deleted)) != Vehicle.Flags.Created) {
             return;
         }
         flag2 = ((data.m_flags & Vehicle.Flags.Reversed) != Vehicle.Flags.None);
         if (flag2 != flag) {
             Singleton<VehicleManager>.instance.ReleaseVehicle (vehicleID);
             return;
         }
     }
     if (flag) {
         num = instance.m_vehicles.m_buffer [(int)num].m_leadingVehicle;
         int num2 = 0;
         while (num != 0) {
             info = instance.m_vehicles.m_buffer [(int)num].Info;
             info.m_vehicleAI.SimulationStep (num, ref instance.m_vehicles.m_buffer [(int)num], vehicleID, ref data, 0);
             if ((data.m_flags & (Vehicle.Flags.Created | Vehicle.Flags.Deleted)) != Vehicle.Flags.Created) {
                 return;
             }
             num = instance.m_vehicles.m_buffer [(int)num].m_leadingVehicle;
             if (++num2 > 65536) {
                 CODebugBase<LogChannel>.Error (LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
                 break;
             }
         }
     } else {
         num = instance.m_vehicles.m_buffer [(int)num].m_trailingVehicle;
         int num3 = 0;
         while (num != 0) {
             info = instance.m_vehicles.m_buffer [(int)num].Info;
             info.m_vehicleAI.SimulationStep (num, ref instance.m_vehicles.m_buffer [(int)num], vehicleID, ref data, 0);
             if ((data.m_flags & (Vehicle.Flags.Created | Vehicle.Flags.Deleted)) != Vehicle.Flags.Created) {
                 return;
             }
             num = instance.m_vehicles.m_buffer [(int)num].m_trailingVehicle;
             if (++num3 > 65536) {
                 CODebugBase<LogChannel>.Error (LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
                 break;
             }
         }
     }
     if ((data.m_flags & (Vehicle.Flags.Spawned | Vehicle.Flags.WaitingPath | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo)) == Vehicle.Flags.None || data.m_blockCounter == 255) {
         Singleton<VehicleManager>.instance.ReleaseVehicle (vehicleID);
     }
 }
开发者ID:klyte45,项目名称:CS-VehicleLimitExpander,代码行数:87,代码来源:FakeTrainAI.cs


注:本文中的Vehicle.Unspawn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。