Пример #1
0
    protected LeveledPool <NPC> GetPool(GenericFlags <SpawnKeywords> keywords)
    {
        LeveledPool <NPC> pool;

        if (!npcPools.TryGetValue(keywords, out pool))
        {
            #region DEBUG
            if (BigBoss.Debug.logging(Logs.NPCs))
            {
                BigBoss.Debug.printHeader(Logs.NPCs, "Get Pool");
                BigBoss.Debug.w(Logs.NPCs, "Keywords:");
                BigBoss.Debug.incrementDepth(Logs.NPCs);
                keywords.ToLog(Logs.NPCs);
                BigBoss.Debug.decrementDepth(Logs.NPCs);
            }
            #endregion
            pool = new LeveledPool <NPC>(DefaultLevelCurve);
            npcPools.Add(keywords, pool);
            foreach (NPC n in BigBoss.Objects.NPCs.Prototypes)
            {
                if (!keywords.Empty && n.SpawnKeywords.Contains(keywords) || // NPC has keywords
                    (keywords.Empty && !n.Flags[NPCFlags.NO_RANDOM_SPAWN]))    // If keywords empty
                {
                    pool.Add(n);
                }
            }
            #region DEBUG
            if (BigBoss.Debug.logging(Logs.NPCs))
            {
                pool.ToLog(Logs.NPCs, "NPCs");
                BigBoss.Debug.printFooter(Logs.NPCs, "Get Pool");
            }
            #endregion
        }
        return(pool);
    }