Exemple #1
0
    public void IncorporateNewDay(AgentDay day)
    {
        int key = day.goalFruitHarvest;

        if (avgWoods.ContainsKey(key))
        {
            //recalculate total
            //would be int but for rounding, could maybe keep track of totals as int
            float totalWoodSoFar = avgWoods[key] * numTries[key];
            totalWoodSoFar += day.numsHarvested[GoalType.Wood];

            numTries[key] += 1;
            avgWoods[key]  = totalWoodSoFar / numTries[key];
        }
        else
        {
            //Add entry into both dictionaries
            numTries.Add(key, 1);
            avgWoods.Add(key, day.numsHarvested[GoalType.Wood]);
        }

        //Update highest/lowest
        highestGoalTried = (int)Mathf.Max(day.numsHarvested[GoalType.Fruit], highestGoalTried);
        lowestGoalTried  = (int)Mathf.Min(day.numsHarvested[GoalType.Fruit], lowestGoalTried);

        determineAllocationCandidates();
    }
Exemple #2
0
    public void AgentIsDone(GameObject agent)
    {
        //If there were multiple agents, track doneness here
        //When all are done, increment day and replenish forest

        //Increment date
        date++;

        //Print summary to Unity console
        //TODO: Make activityLog and daysLog private and delete code below once this kind of
        //logging is no longer useful.
        AgentDay lastLog  = ac.activityLog.daysLog.Last();
        int      lastDate = lastLog.date; //Should be same as date
        int      lastGoal = lastLog.goalFruitHarvest;
        float    trees    = lastLog.numsHarvested[GoalType.Wood];
        float    mangoes  = lastLog.numsHarvested[GoalType.Fruit];

        Debug.Log(
            "On day " + lastDate.ToString() + ", agent harvested " +
            trees.ToString() + " trees and " + mangoes.ToString() +
            " mangoes. By going for " + lastGoal.ToString() +
            " mangoes."
            );

        ReplenishPhase();
    }
Exemple #3
0
 public void AddDay(AgentDay day)
 {
     daysLog.Add(day);
 }