Ejemplo n.º 1
0
 public bool Contain(GridCell gCell)
 {
     if (gCell == null)
     {
         return(false);
     }
     return(Cells.Contains(gCell));
 }
Ejemplo n.º 2
0
        private void CheckMissedColumns(Table table)
        {
            var missed = table.Columns.Required.Where(col => !Cells.Contains(col.Name));

            if (missed.Any())
            {
                throw new MissedCellsException(missed, Resources.RequiredCellsMissed.FormatExt(table.Name));
            }
        }
 public IEnumerable <Fighter> GetAffecteds(Fight fight)
 {
     foreach (var fighter in fight.GetAllFighters())
     {
         if (Cells.Contains(fighter.CellId))
         {
             yield return(fighter);
         }
     }
 }
Ejemplo n.º 4
0
 public IEnumerable <Cell> GetCellsVisibleTo(Cell cell)
 {
     if (Cells.Contains(cell))
     {
         return(Cells.Where(other => other != cell));
     }
     else
     {
         return(Enumerable.Empty <Cell>());
     }
 }
Ejemplo n.º 5
0
        public void AfterMove(Fighter source, object arg1, object arg2, object arg3)
        {
            List <short> path = (List <short>)arg2;

            foreach (var cell in path)
            {
                if (Cells.Contains(cell))
                {
                    Explode(source);
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        public Cell NextCell(Cell cell)
        {
            if (Cells.Contains(cell) == false)
            {
                return(null);
            }

            int index = Cells.IndexOf(cell);

            if (index + 1 < Cells.Count)
            {
                return(Cells [index + 1]);
            }
            return(null);
        }
Ejemplo n.º 7
0
        public Cell PreviousCell(Cell cell)
        {
            if (Cells.Contains(cell) == false)
            {
                return(null);
            }

            int index = Cells.IndexOf(cell);

            if (index - 1 >= 0)
            {
                return(Cells [index - 1]);
            }
            return(null);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Fusion the specified other path.
        /// </summary>
        /// <param name="otherPath">Other path.</param>
        public void Fusion(Path otherPath)
        {
            // The otherPath is the loser
            // We transfer its data
            // Then we kill it

            // Dequeue cells
            for (int i = otherPath.Cells.Count - 1; i >= 0; i--)
            {
                Cell cell = otherPath.Cells [i];
                if (Cells.Contains(cell) == false)
                {
                    AddCell(cell);
                }
            }

            otherPath.Cells.Clear();
        }
Ejemplo n.º 9
0
        public Grid Next(IEnumerable <IRule> rules)
        {
            var newCells = new List <Point>();

            for (var x = 0; x < Size; x++)
            {
                for (var y = 0; y < Size; y++)
                {
                    var point = new Point(x, y);

                    var lives = rules.Any(r => r.Apply(point, Cells.Contains(point), point.LivingNeighbors(Cells)));

                    if (lives)
                    {
                        newCells.Add(point);
                    }
                }
            }

            return(new Grid(newCells, Size));
        }
Ejemplo n.º 10
0
 public bool CanBuildTowerIn(TowerCell towerCell, ITower tower, int cost)
 => Cells.Contains(towerCell) && (towerCell?.Buildable ?? false) && cost <= Gold;
Ejemplo n.º 11
0
 public bool Contains(ITableCellViewModel cell)
 {
     return(Cells.Contains(cell));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Determines if the file contains a Cell
 /// </summary>
 /// <param name="item">Cell to check for</param>
 /// <returns>True if it does, false otherwise</returns>
 public bool Contains(Cell item)
 {
     return(Cells.Contains(item));
 }