Esempio n. 1
0
        private void RemoveBomb(Common.Location location)
        {
            List <Bomb> TempBombs = (from b in this.Bombs where b.Location.Column == location.Column && b.Location.Row == location.Row select b).ToList <Bomb>();

            for (int i = 0; i < TempBombs.Count; i++)
            {
                this.Bombs.Remove(TempBombs[i]);
            }
        }
Esempio n. 2
0
        private Common.Location FindEmptyLocation()
        {
            Common.Location __Location   = new Common.Location();
            int             RandomNumber = r.Next((this._GameWorld.Columns * this._GameWorld.Rows));

            __Location.Column = (RandomNumber / this._GameWorld.Rows);
            __Location.Row    = (RandomNumber % this._GameWorld.Rows);

            int HitCounter = (from Common.Location l in this._GameWorld.PopulatedLocations where __Location.Column == l.Column && __Location.Row == l.Row select l).Count();

            if (HitCounter > 0)
            {
                __Location = FindEmptyLocation();
            }
            return(__Location);
        }
Esempio n. 3
0
        private Common.Location FindEmptyLocation()
        {
            Common.Location __Location   = new Common.Location();
            int             RandomNumber = r.Next((this.WorldGrid.ColumnDefinitions.Count * this.WorldGrid.RowDefinitions.Count));

            __Location.Column = (RandomNumber / this.WorldGrid.RowDefinitions.Count);
            __Location.Row    = (RandomNumber % this.WorldGrid.RowDefinitions.Count);

            for (int i = 0; i < this.WorldGrid.Children.Count; i++)
            {
                if (__Location.Column == Grid.GetColumn(this.WorldGrid.Children[i]) && __Location.Row == Grid.GetRow(this.WorldGrid.Children[i]))
                {
                    __Location = FindEmptyLocation();
                }
            }


            return(__Location);
        }