Exemplo n.º 1
0
 public void Apply(Simulation sim, ResourceCollection resources)
 {
     if (resources.CanApplyNextCycle(OperatingCost))
     {
         resources.ApplyNextCycle(OperatingCost);
         resources.GetResource(ResourceType.Deflection).ChangeNextCycle += sim.MaxTime - sim.CurrentTime;
     }
 }
Exemplo n.º 2
0
 public ResourceCollection(ResourceCollection other) : this()
 {
     foreach (Resource resource in Resources)
     {
         Resource otherResource = other.GetResource(resource.Type);
         resource.Amount          = otherResource.Amount;
         resource.ChangeNextCycle = otherResource.ChangeNextCycle;
     }
 }
Exemplo n.º 3
0
 public void Apply(Simulation sim, ResourceCollection resources)
 {
     resources.GetResource(Type).ChangeNextCycle += Growth;
 }
Exemplo n.º 4
0
    public void BuyUpgrade(Upgrade upgrade)
    {
        foreach (ResourceDelta cost in upgrade.Cost)
        {
            if (!resources.CanApplyImmediate(cost))
            {
                throw new Exception(
                          $"Expected at least {cost.Amount} of {cost.Type}, found only {resources.GetResource(cost.Type).Amount}." +
                          $"This should not happen, because we should have fastforwarded until there was enough!");
            }
            resources.ApplyImmediate(cost);
        }

        boughtUpgrades.Add(upgrade);
        boughtUpgradeTimes.Add(CurrentTime);

        RecalculateNextCycle();
    }