本文整理汇总了C#中Sim.GetReservedVehicle方法的典型用法代码示例。如果您正苦于以下问题:C# Sim.GetReservedVehicle方法的具体用法?C# Sim.GetReservedVehicle怎么用?C# Sim.GetReservedVehicle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sim
的用法示例。
在下文中一共展示了Sim.GetReservedVehicle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CleanUpReservedVehicle
private static void CleanUpReservedVehicle(Sim sim)
{
Vehicle reservedVehicle = sim.GetReservedVehicle();
if (((reservedVehicle != null) && (sim.Inventory != null)) && !sim.Inventory.Contains(reservedVehicle))
{
sim.Inventory.TryToAdd(reservedVehicle);
reservedVehicle.RemoveFromWorld();
sim.SetReservedVehicle(null);
}
}
示例2: CreationProtection
public CreationProtection(SimDescription sim, Sim createdSim, bool performLoadFixup, bool performSelectable, bool performUnselectable)
{
try
{
mSim = sim;
Corrections.RemoveFreeStuffAlarm(sim);
// Stops an issue in "GrantFutureObjects" regarding the use of sIsChangingWorlds=true
mWasFutureSim = sim.TraitManager.HasElement(TraitNames.FutureSim);
sim.TraitManager.RemoveElement(TraitNames.FutureSim);
if (SimTypes.IsSelectable(mSim))
{
Corrections.CleanupBrokenSkills(mSim, null);
}
if (OpportunityTrackerModel.gSingleton != null)
{
mOpportunitiesChanged = OpportunityTrackerModel.gSingleton.OpportunitiesChanged;
OpportunityTrackerModel.gSingleton.OpportunitiesChanged = null;
}
if (mSim.TraitChipManager != null)
{
mChips = mSim.TraitChipManager.GetAllTraitChips();
mSim.TraitChipManager.mTraitChipSlots = new TraitChip[7];
mSim.TraitChipManager.mValues.Clear();
}
if (createdSim != null)
{
if (createdSim.BuffManager != null)
{
mBuffs = new List<BuffInstance>();
foreach (BuffInstance buff in createdSim.BuffManager.List)
{
mBuffs.Add(buff);
}
}
if (createdSim.Motives != null)
{
Motive motive = createdSim.Motives.GetMotive(CommodityKind.AcademicPerformance);
if (motive != null)
{
mAcademicPerformance = motive.Value;
}
motive = createdSim.Motives.GetMotive(CommodityKind.UniversityStudy);
if (motive != null)
{
mUniversityStudy = motive.Value;
}
}
if (createdSim.Inventory != null)
{
mInventory = createdSim.Inventory.DestroyInventoryAndStoreInList();
}
mDreamStore = new DreamCatcher.DreamStore(createdSim, false, false);
mReservedVehicle = createdSim.GetReservedVehicle();
createdSim.ReservedVehicle = null;
}
SafeStore.Flag flags = SafeStore.Flag.None;
if (performSelectable)
{
flags |= SafeStore.Flag.Selectable;
}
if (performLoadFixup)
{
flags |= SafeStore.Flag.LoadFixup;
}
if (performUnselectable)
{
flags |= SafeStore.Flag.Unselectable;
}
mSafeStore = new SafeStore(mSim, flags);
// Stops the startup errors when the imaginary friend is broken
mDoll = GetDollForSim(sim);
if (mDoll != null)
{
mDoll.mOwner = null;
}
mGenealogy = sim.mGenealogy;
mRelations = Relationships.StoreRelations(sim, null);
// Stops all event processing during the creation process
EventTracker.sCurrentlyUpdatingDreamsAndPromisesManagers = true;
//.........这里部分代码省略.........
示例3: GetOwnedAndUsableVehicle
public static Vehicle GetOwnedAndUsableVehicle(Sim ths, Lot lot, bool bAddPending, bool bAllowBikes, bool bIgnoreCanDrive, bool allowUFO)
{
if (ths.IsPet)
{
return null;
}
Vehicle vehicleForCurrentInteraction = ths.GetVehicleForCurrentInteraction();
if (vehicleForCurrentInteraction != null)
{
return vehicleForCurrentInteraction;
}
/*
if (GameUtils.IsInstalled(ProductVersion.EP2))
{
ActiveFireFighter occupation = ths.Occupation as ActiveFireFighter;
if (occupation != null)
{
Car vehicle = occupation.GetVehicle(bAddPending);
if (vehicle != null)
{
return vehicle;
}
}
}
*/
Vehicle reservedVehicle = ths.GetReservedVehicle();
if ((reservedVehicle != null) && (bAllowBikes || (!(reservedVehicle is Bicycle) && !(reservedVehicle is MagicBroom))))
{
IOwnableVehicle vehicle3 = reservedVehicle as IOwnableVehicle;
if (vehicle3 == null)
{
return reservedVehicle;
}
if (ths.CanUseVehicleRightNow(vehicle3, true, true))
{
if (bAddPending)
{
vehicle3.PendingUse = true;
}
return reservedVehicle;
}
}
/*
if (ths.OccupationAsPerformanceCareer != null)
{
Car car2 = ths.OccupationAsPerformanceCareer.GetCareerCar();
if (car2 != null)
{
return car2;
}
}
else if (ths.CareerManager.OccupationAsCareer != null)
{
FortuneTellerCareer career = ths.CareerManager.Occupation as FortuneTellerCareer;
if (((career != null) && (career.CurLevelBranchName == "ScamArtist")) && (career.Level >= FortuneTellerCareer.kLevelNeededForLimoRide))
{
Car car3 = GlobalFunctions.CreateObjectOutOfWorld("CarLimo") as Car;
car3.DestroyOnRelease = true;
return car3;
}
}
*/
IOwnableVehicle preferredVehicle = ths.GetPreferredVehicle();
if (ths.CanUseVehicleRightNow(preferredVehicle, true, bIgnoreCanDrive) && (bAllowBikes || (!(reservedVehicle is Bicycle) && !(reservedVehicle is MagicBroom))))
{
if (bAddPending)
{
preferredVehicle.PendingUse = true;
}
return (preferredVehicle as Vehicle);
}
if (bAllowBikes && ths.HasTrait(TraitNames.Rebellious))
{
IOwnableVehicle motorcycleIfAvailable = ths.GetMotorcycleIfAvailable(bAddPending, bIgnoreCanDrive);
if (motorcycleIfAvailable != null)
{
return (motorcycleIfAvailable as Vehicle);
}
}
if (bAllowBikes && ths.HasTrait(TraitNames.EnvironmentallyConscious))
{
IOwnableVehicle bikeIfAvailable = ths.GetBikeIfAvailable(bAddPending, bIgnoreCanDrive);
if (bikeIfAvailable != null)
{
return (bikeIfAvailable as Vehicle);
}
}
// Custom
List<IOwnableVehicle> vehicles = Inventories.QuickDuoFind<IOwnableVehicle, Vehicle>(ths.Inventory);
IOwnableVehicle vehicle = ths.GetBroomOrMostExpensiveUsableVehicle(vehicles, bAllowBikes, bAddPending, bIgnoreCanDrive, allowUFO, false);
if (vehicle != null)
//.........这里部分代码省略.........