能量
// Token: 0x060009D3 RID: 2515 RVA: 0x00062263 File Offset: 0x00060463
public void SetEnergyAmount(float amount)
{
this.EnergyAmount = this._energyCapacity;-------------
this.OnEnergyUpdateEvent.Invoke();
}
// Token: 0x060009D4 RID: 2516 RVA: 0x00062287 File Offset: 0x00060487
public bool TryRequestEnergy(float energyAmount, out float returnedAmount)
{
if (this.EnergyAmount - energyAmount >= 0f)
{
this.SetEnergyAmount(this.EnergyAmount - energyAmount);
returnedAmount = energyAmount;-
return true;
}
returnedAmount = this.EnergyCapacity;----------
this.SetEnergyAmount(this.EnergyCapacity);----------------------
return false;
}
// Token: 0x060009D5 RID: 2517 RVA: 0x000BC0A4 File Offset: 0x000BA2A4
public bool TryAddEnergy(float energyAmount, out float addedAmount)
{
if (this.EnergyAmount + energyAmount <= this.EnergyCapacity)
{
this.SetEnergyAmount(this.EnergyAmount + energyAmount);
addedAmount = energyAmount;
return true;
}
addedAmount = this.EnergyCapacity;
this.SetEnergyAmount(this.EnergyCapacity);
return false;
}
移动速度
public float MovementSpeed
{
get
{
return EnergyDevTools.ApplyMovementSpeed(this._movementSpeed) * this._engine.ReturnMovementSpeed() * 2f;
}
}
// Token: 0x17000C49 RID: 3145
// (get) Token: 0x060045E8 RID: 17896
public float RotationSpeed
{
get
{
return EnergyDevTools.ApplyMovementSpeed(this._rotationSpeed) * this._engine.ReturnMovementSpeed() * 2f;
}
}
生产数量
public List<Item> ReturnProducedItems()
{
List<Item> list = new List<Item>();
for (int i = 0; i < this.ProducedItems.Count; i++)
{
for (int j = 0; j < this.ProducedItems[i].Amount; j++)
{
list.Add(new Item(this.ProducedItems[i].ItemProperties));
if (this.ProducedItems[i].ItemProperties.Tags != Item.Tags.Resource)
{
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));//太多会卡 两三个就行
}
}
}
return list;
}
时间修改//不推荐影响颇大黑夜完成后存档读档才能开始新的一天
public void NextDay()
{
if (this.CurrentDay != null)
{
this.CurrentDay.Finish();
DayEvent.Dispatch(GameEventType.DayEnded, this.CurrentDay, this.Days);
}
this._dayDuration *= 10000f;
this._nightDuration /= 10f;
this._hoursInDay *= 10000;
this.CurrentDay = new Day(this._dayDuration, this._nightDuration, this._hoursInDay);
this.Days.Add(this.CurrentDay);
DayEvent.Dispatch(GameEventType.DayStarted, this.CurrentDay, this.Days);
}
储存修改
public SubInventory GetOrAddSubInventory(SubInventoryType subInventoryType, int capacity = 2147483647)
{
SubInventory subInventory;
if (this._subInventories.TryGetValue(subInventoryType, out subInventory))
{
return subInventory;
}
subInventory = new SubInventory(subInventoryType, 1000);//太大会卡
this.AddSubInventory(subInventory);
return subInventory;
}
生产修改
public void AdvanceQueuedRecipeStage(QueuedRecipe queuedRecipe, bool autoProduce)
{
switch (queuedRecipe.RecipeStage)
{
case QueuedRecipe.Stage.WaitingToReserveItems:
break;
case QueuedRecipe.Stage.WaitingToImport:
base.Buildable.SetStatus(GameManager.Settings.BuildableSettings.StatusWaitingForResourcesProperties);
return;
case QueuedRecipe.Stage.WaitingToProduce:
base.Buildable.SetStatus(GameManager.Settings.BuildableSettings.StatusWaitingForProducerProperties);
if (this.IsBlockedByImport)
{
}
if (base.Buildable.Inventory.ReturnCapacity(SubInventoryType.Export) < base.Buildable.Inventory.ReturnCount(SubInventoryType.Export, false) + queuedRecipe.ReturnProducedItemCount())
{
}
if (this.HasEnergyCost)
{
if (this.Connector.EnergyGrid.HasEnergy)
{
base.Buildable.RemoveMalfunction(GameManager.Settings.BuildableSettings.ErrorNoEnergyProperties);
}
}
if (autoProduce)
{
this.StartProducing(queuedRecipe, 1f);
}
this.UpdateProducerVisuals(queuedRecipe);
return;
case QueuedRecipe.Stage.Producing:
base.Buildable.SetStatus(GameManager.Settings.BuildableSettings.StatusWorkingProperties);
if (autoProduce)
{
if (!this.HasEnergyCost || !this.Connector.EnergyGrid.HasEnergy)
{
}
this.Produce(queuedRecipe, 1f);
}
this.UpdateProducerVisuals(queuedRecipe);
if (queuedRecipe.Progress < queuedRecipe.ProductionTime)
{
}
this.FinishQueuedRecipe(queuedRecipe);
return;
case QueuedRecipe.Stage.WaitingToExportItems:
base.Buildable.SetStatus(GameManager.Settings.BuildableSettings.StatusProducerHaulingItemstoStorageProperties);
if (queuedRecipe.RecipeItems.Count == 0)
{
Debug.LogException(new Exception("QueuedRecipe with 0 recipe item is waiting to export items which should be impossible...!"));
if (this._properties.Type == Producer.Type.Workshop)
{
this.RemoveQueuedRecipe(queuedRecipe);
return;
}
queuedRecipe.Reset(this.SelectedRecipeIndex, this.Recipes, true);
}
break;
default:
return;
}
}
// Token: 0x060009D3 RID: 2515 RVA: 0x00062263 File Offset: 0x00060463
public void SetEnergyAmount(float amount)
{
this.EnergyAmount = this._energyCapacity;-------------
this.OnEnergyUpdateEvent.Invoke();
}
// Token: 0x060009D4 RID: 2516 RVA: 0x00062287 File Offset: 0x00060487
public bool TryRequestEnergy(float energyAmount, out float returnedAmount)
{
if (this.EnergyAmount - energyAmount >= 0f)
{
this.SetEnergyAmount(this.EnergyAmount - energyAmount);
returnedAmount = energyAmount;-
return true;
}
returnedAmount = this.EnergyCapacity;----------
this.SetEnergyAmount(this.EnergyCapacity);----------------------
return false;
}
// Token: 0x060009D5 RID: 2517 RVA: 0x000BC0A4 File Offset: 0x000BA2A4
public bool TryAddEnergy(float energyAmount, out float addedAmount)
{
if (this.EnergyAmount + energyAmount <= this.EnergyCapacity)
{
this.SetEnergyAmount(this.EnergyAmount + energyAmount);
addedAmount = energyAmount;
return true;
}
addedAmount = this.EnergyCapacity;
this.SetEnergyAmount(this.EnergyCapacity);
return false;
}
移动速度
public float MovementSpeed
{
get
{
return EnergyDevTools.ApplyMovementSpeed(this._movementSpeed) * this._engine.ReturnMovementSpeed() * 2f;
}
}
// Token: 0x17000C49 RID: 3145
// (get) Token: 0x060045E8 RID: 17896
public float RotationSpeed
{
get
{
return EnergyDevTools.ApplyMovementSpeed(this._rotationSpeed) * this._engine.ReturnMovementSpeed() * 2f;
}
}
生产数量
public List<Item> ReturnProducedItems()
{
List<Item> list = new List<Item>();
for (int i = 0; i < this.ProducedItems.Count; i++)
{
for (int j = 0; j < this.ProducedItems[i].Amount; j++)
{
list.Add(new Item(this.ProducedItems[i].ItemProperties));
if (this.ProducedItems[i].ItemProperties.Tags != Item.Tags.Resource)
{
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));
list.Add(new Item(this.ProducedItems[i].ItemProperties));//太多会卡 两三个就行
}
}
}
return list;
}
时间修改//不推荐影响颇大黑夜完成后存档读档才能开始新的一天
public void NextDay()
{
if (this.CurrentDay != null)
{
this.CurrentDay.Finish();
DayEvent.Dispatch(GameEventType.DayEnded, this.CurrentDay, this.Days);
}
this._dayDuration *= 10000f;
this._nightDuration /= 10f;
this._hoursInDay *= 10000;
this.CurrentDay = new Day(this._dayDuration, this._nightDuration, this._hoursInDay);
this.Days.Add(this.CurrentDay);
DayEvent.Dispatch(GameEventType.DayStarted, this.CurrentDay, this.Days);
}
储存修改
public SubInventory GetOrAddSubInventory(SubInventoryType subInventoryType, int capacity = 2147483647)
{
SubInventory subInventory;
if (this._subInventories.TryGetValue(subInventoryType, out subInventory))
{
return subInventory;
}
subInventory = new SubInventory(subInventoryType, 1000);//太大会卡
this.AddSubInventory(subInventory);
return subInventory;
}
生产修改
public void AdvanceQueuedRecipeStage(QueuedRecipe queuedRecipe, bool autoProduce)
{
switch (queuedRecipe.RecipeStage)
{
case QueuedRecipe.Stage.WaitingToReserveItems:
break;
case QueuedRecipe.Stage.WaitingToImport:
base.Buildable.SetStatus(GameManager.Settings.BuildableSettings.StatusWaitingForResourcesProperties);
return;
case QueuedRecipe.Stage.WaitingToProduce:
base.Buildable.SetStatus(GameManager.Settings.BuildableSettings.StatusWaitingForProducerProperties);
if (this.IsBlockedByImport)
{
}
if (base.Buildable.Inventory.ReturnCapacity(SubInventoryType.Export) < base.Buildable.Inventory.ReturnCount(SubInventoryType.Export, false) + queuedRecipe.ReturnProducedItemCount())
{
}
if (this.HasEnergyCost)
{
if (this.Connector.EnergyGrid.HasEnergy)
{
base.Buildable.RemoveMalfunction(GameManager.Settings.BuildableSettings.ErrorNoEnergyProperties);
}
}
if (autoProduce)
{
this.StartProducing(queuedRecipe, 1f);
}
this.UpdateProducerVisuals(queuedRecipe);
return;
case QueuedRecipe.Stage.Producing:
base.Buildable.SetStatus(GameManager.Settings.BuildableSettings.StatusWorkingProperties);
if (autoProduce)
{
if (!this.HasEnergyCost || !this.Connector.EnergyGrid.HasEnergy)
{
}
this.Produce(queuedRecipe, 1f);
}
this.UpdateProducerVisuals(queuedRecipe);
if (queuedRecipe.Progress < queuedRecipe.ProductionTime)
{
}
this.FinishQueuedRecipe(queuedRecipe);
return;
case QueuedRecipe.Stage.WaitingToExportItems:
base.Buildable.SetStatus(GameManager.Settings.BuildableSettings.StatusProducerHaulingItemstoStorageProperties);
if (queuedRecipe.RecipeItems.Count == 0)
{
Debug.LogException(new Exception("QueuedRecipe with 0 recipe item is waiting to export items which should be impossible...!"));
if (this._properties.Type == Producer.Type.Workshop)
{
this.RemoveQueuedRecipe(queuedRecipe);
return;
}
queuedRecipe.Reset(this.SelectedRecipeIndex, this.Recipes, true);
}
break;
default:
return;
}
}









