示例#1
0
 public void OnMaxPopulationUpdated(FactionSlot factionSlot, int value)
 {
     //if this update belongs to the faction managed by this component:
     if (factionSlot.FactionMgr.FactionID == factionMgr.FactionID)
     {
         maxPopulation = factionSlot.GetMaxPopulation();
         CheckFreePopulationSlots(factionSlot.GetFreePopulation());
     }
 }
        /// <summary>
        /// Called whenever a faction has its maximum or current populations slots updated.
        /// </summary>
        /// <param name="factionSlot">The FactionSlot instance that manages the faction whose max or current population is updated.</param>
        /// <param name="value">The value by which the max or current population is updated.</param>
        private void OnPopulationUpdated(FactionSlot factionSlot, int value)
        {
            if (factionSlot.ID != factionMgr.FactionID) //not this NPC faction?
            {
                return;
            }

            if (factionSlot.GetFreePopulation() + pendingPopulationSlots < minFreePopulationSlots) //if the amount of free population slots is too low
            {
                Activate();                                                                        //activate this component so it can push to place population buildings.
            }
        }