Esempio n. 1
0
    /// <summary>
    /// Step this instance.
    /// </summary>
    public override void Step()
    {
        // Do a certain number of actions based loosely on the population,
        // the frequency of the reference action, the overall sum of action
        // frequencies, and the target number of iterations...
        // target_iterations and reference_action (as well as all action frequencies)
        // asre set in ActionLibrary
        float fib_factor = PersonTown.Singleton.aliveResidents.Count / 10.0f;

        for (int i = 0; i < (ActionLibrary.ActualIterations * fib_factor); i++)
        {
            ActionType randAction = ActionLibrary.FrequencyFilteredRandomSelection();
            if (randAction != null)
            {
                randAction.InstantiateAndExecute();
            }
            else
            {
                continue;
            }
        }

        if (PersonTown.Singleton.aliveResidents.Count == 0) // Town is dead
        {
            return;
        }
    }