Пример #1
0
    public Value getMiddleNeedFullfilling(PopType type)
    {
        Value          result        = new Value(0);
        uint           allPopulation = 0;
        List <PopUnit> localPops     = FindAllPopUnits(type);

        if (localPops.Count > 0)
        {
            foreach (PopUnit pop in localPops)
            // get middle needs fullfiling according to pop weight
            {
                allPopulation += pop.population;
                result.add(pop.NeedsFullfilled.multiple(pop.population));
            }
            return(result.divide(allPopulation));;
        }
        else/// add defualt population
        {
            //PopUnit.tempPopList.Add(new PopUnit(Province.defaultPopulationSpawn, type, this.owner.culture, this));
            PopUnit.tempPopList.Add(PopUnit.Instantiate(Province.defaultPopulationSpawn, type, this.owner.culture, this));
            //return new Value(float.MaxValue);// meaning always convert in type if does not exist yet
            return(new Value(0));
        }
    }