예제 #1
0
        protected SpawnDict(SpawnDict <TK, TV> other)
        {
            this.spawns = new Dictionary <TK, SpawnRate>();

            foreach (TK key in other.spawns.Keys)
            {
                this.spawns.Add(key, new SpawnRate(other.spawns[key].Spawn, other.spawns[key].Rate));
            }
        }
예제 #2
0
 public CategorySpawnChooser(CategorySpawnChooser <T> other)
 {
     Spawns = new SpawnDict <string, SpawnList <T> >();
     foreach (string key in other.Spawns.GetKeys())
     {
         SpawnList <T> list      = new SpawnList <T>();
         SpawnList <T> otherList = other.Spawns.GetSpawn(key);
         for (int ii = 0; ii < otherList.Count; ii++)
         {
             list.Add(otherList.GetSpawn(ii), otherList.GetSpawnRate(ii));
         }
         Spawns.Add(key, list, other.Spawns.GetSpawnRate(key));
     }
 }
예제 #3
0
        public SpawnDict <TK, TV> GetSpawnList(int level)
        {
            SpawnDict <TK, TV> newList = new SpawnDict <TK, TV>();

            foreach (TK key in this.spawns.Keys)
            {
                SpawnRange spawn = this.spawns[key];
                if (spawn.Range.Min <= level && level < spawn.Range.Max)
                {
                    newList.Add(key, spawn.Spawn, spawn.Rate);
                }
            }

            return(newList);
        }
예제 #4
0
        public T Pick(IRandom rand)
        {
            SpawnDict <string, SpawnList <T> > tempSpawn = new SpawnDict <string, SpawnList <T> >();

            foreach (string key in Spawns.GetKeys())
            {
                SpawnList <T> otherList = Spawns.GetSpawn(key);
                if (!otherList.CanPick)
                {
                    continue;
                }
                tempSpawn.Add(key, otherList, Spawns.GetSpawnRate(key));
            }
            SpawnList <T> choice = tempSpawn.Pick(rand);

            return(choice.Pick(rand));
        }
예제 #5
0
 public CategorySpawnChooser(SpawnDict <string, SpawnList <T> > spawns)
 {
     Spawns = spawns;
 }
예제 #6
0
 public CategorySpawnChooser()
 {
     Spawns = new SpawnDict <string, SpawnList <T> >();
 }