本文整理汇总了C#中Common.AddStat方法的典型用法代码示例。如果您正苦于以下问题:C# Common.AddStat方法的具体用法?C# Common.AddStat怎么用?C# Common.AddStat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common
的用法示例。
在下文中一共展示了Common.AddStat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Perform
protected static bool Perform(Common.IStatGenerator stats, SimDescription sim, int amount, ref bool push)
{
if (sim.CreatedSim == null)
{
stats.IncStat("Hibernating");
return false;
}
else if (!Inventories.VerifyInventory(sim))
{
stats.IncStat("No Inventory");
return false;
}
School school = sim.CareerManager.School;
if (school != null)
{
if (school.OwnersHomework == null)
{
school.OwnersHomework = GlobalFunctions.CreateObjectOutOfWorld("Homework") as Homework;
school.OwnersHomework.OwningSimDescription = sim;
Inventories.TryToMove(school.OwnersHomework, sim.CreatedSim);
stats.IncStat("Homework Created");
}
if ((!sim.CreatedSim.Inventory.Contains(school.OwnersHomework)) &&
(school.OwnersHomework.LotCurrent != sim.CreatedSim.LotCurrent) &&
(school.OwnersHomework.UseCount == 0))
{
Inventories.TryToMove(school.OwnersHomework, sim.CreatedSim);
stats.IncStat("Homework Moved");
}
}
if (amount > 100)
{
amount = 100;
}
bool success = false;
foreach (Homework obj in Inventories.InventoryFindAll<Homework>(sim))
{
if (obj.PercentComplete < 0) continue;
if ((amount < 0) || (obj.PercentComplete < amount))
{
obj.PercentComplete = amount;
stats.AddStat("Homework Value", amount);
if (amount > 90)
{
push = true;
}
success = true;
}
}
return success;
}