예제 #1
0
    public void DoTurn()
    {
        ResourcesStorage.Tick();

        doingTurn = true;
        for (int i = 0; i < numCompletedProjectsNextTurn; i++)
        {
            projects[i].OnProjectCompleted();
        }
        projects.RemoveRange(0, numCompletedProjectsNextTurn);
        doingTurn = false;

        CalculateNextTurn();
    }
    public void HappyCase()
    {
        var storages = new ResourcesStorage();

        storages.AddDelta(new ResourceDelta(ResourceType.Air, 20));
        storages.AddDelta(new ResourceDelta(ResourceType.Food, -20));

        Assert.AreEqual(20, storages.NextAmount(ResourceType.Air));
        Assert.AreEqual(-20, storages.NextAmount(ResourceType.Food));

        storages.Tick();

        Assert.AreEqual(20, storages.NextAmount(ResourceType.Air));
        Assert.AreEqual(20, storages.ResourceStorages[ResourceType.Air].CurrentAmount);
    }