Esempio n. 1
0
        /// <see cref="InfestationAlgorithmBase._runAlgorithm(IAlgorithmContext)"/>
        protected override void _runAlgorithm(IAlgorithmContext context)
        {
            Library _l = context.L;
            Dungeon _d = context.D;
            Random  _r = context.R;

            // Add one thing to each group in the dungeon
            foreach (TileGroupInfo group in _d.Groups.Where(grp => context.Mask.ContainsAny(grp.Tiles)))
            {
                InfestationInfo randomItem = _l.AllInfestations.Where(info => info.Category == InfestationType.Item)
                                             .Random(_r);
                _d.Infestations.Associate(group, randomItem);
            }
        }
Esempio n. 2
0
        public void SafeAdd(Tile k, InfestationInfo newElement)
        {
            if (k == null)
            {
                return;
            }
            if (newElement == null)
            {
                return;
            }

            InfestationInfoList valueCollection = null;

            if (!TryGetValue(k, out valueCollection))
            {
                Add(k, new InfestationInfoList());
            }

            this[k].Add(newElement);
        }
Esempio n. 3
0
 public void Associate(Tile k, InfestationInfo newElement)
 {
     TileInfestations.SafeAdd(k, newElement);
 }
Esempio n. 4
0
 public void Associate(TileGroupInfo k, InfestationInfo newElement)
 {
     GroupInfestations.SafeAdd(k, newElement);
 }
Esempio n. 5
0
 public void Associate(InfestationInfo newElement)
 {
     OverallInfestations.Add(newElement);
 }