コード例 #1
0
    private float GetPopulation(SocialNode node)
    {
        float answer = 1;

        for (int i = 0; i < node.GetDepth(); i++)
        {
            int roll = Random.Range(2, 5);
            answer *= roll;
        }
        return(answer);
    }
コード例 #2
0
    private List <T> GetSpecificRooms <T>(SocialNode node, SocialStructure socialStructure, int roomPopulationScale) where T : AssignedRoom, new()
    {
        var   output            = new List <T>();
        var   numTiers          = maxSocialTier + 1;
        float grandiosity       = ((float)numTiers - (float)node.GetDepth()) / (float)numTiers;
        float numberPerRoomRoll = Random.Range(grandiosity / 2, grandiosity * 1.5f);
        int   numberPerRoom     = (int)(roomPopulationScale - (numberPerRoomRoll * roomPopulationScale));

        numberPerRoom = Mathf.Max(numberPerRoom, 1);
        int numRooms = (int)(Mathf.Ceil((float)FetchPopulationCount(socialStructure, node) / (float)numberPerRoom));

        for (int i = 0; i < numRooms; i++)
        {
            grandiosity = Random.Range(grandiosity / 2, grandiosity * 1.5f);
            T room = new T {
                grandiosity = grandiosity,
                socialTier  = node.GetDepth()
            };
            output.Add(room);
        }
        AssignInhabitants(socialStructure, node, output, numberPerRoom);
        return(output);
    }