protected Agent RequestCurrentLeader(int leadershipSpan, int minStartAge, int maxStartAge, int offset)
    {
        //		Profiler.BeginSample ("RequestCurrentLeader - GeneratePastSpawnDate");

        long spawnDate = CoreGroup.GeneratePastSpawnDate(CoreGroup.LastUpdateDate, leadershipSpan, offset++);

        //		Profiler.EndSample ();

        if ((LastLeader != null) && (spawnDate < LeaderStartDate))
        {
            return(LastLeader);
        }

        //		Profiler.BeginSample ("RequestCurrentLeader - GetLocalRandomInt");

        // Generate a birthdate from the leader spawnDate (when the leader takes over)
        int startAge = minStartAge + CoreGroup.GetLocalRandomInt(spawnDate, offset++, maxStartAge - minStartAge);

        //		Profiler.EndSample ();

        Profiler.BeginSample("RequestCurrentLeader - new Agent");

        LastLeader      = new Agent(CoreGroup, spawnDate - startAge, Id);
        LeaderStartDate = spawnDate;

        Profiler.EndSample();

        return(LastLeader);
    }
Example #2
0
    private void GenerateBio(CellGroup birthGroup)
    {
        int rngOffset = RngOffsets.AGENT_GENERATE_BIO + unchecked ((int)Id);

        IsFemale     = birthGroup.GetLocalRandomFloat(BirthDate, rngOffset++) > 0.5f;
        BaseCharisma = MinAttributeValue + birthGroup.GetLocalRandomInt(BirthDate, rngOffset++, AttributeGenMax);
        BaseWisdom   = MinAttributeValue + birthGroup.GetLocalRandomInt(BirthDate, rngOffset++, AttributeGenMax);
    }