public override IEnumerable<GameObject> ProduceObjects()
        {
            if (this.IsDestroyed)
            {
                var producedObjects = new List<GameObject>(9);
                int length = 3;
                int startRow = this.topLeft.Row - 1;
                int endRol = startRow + length;
                int startCol = this.topLeft.Col - 1;
                int endCol = startCol + length;

                for (int row = startRow; row < endRol; row++)
                {
                    for (int col = startCol; col < endCol; col++)
                    {
                        var fragment = new Fragment(new MatrixCoords(row, col));

                        producedObjects.Add(fragment);
                    }
                }

                return producedObjects;
            }

            return base.ProduceObjects();
        }
예제 #2
0
 public List<Fragment> CreateFragmentArray()
 {
     Fragment firstFragment =
         new Fragment(this.topLeft, new MatrixCoords(-1, 0), FragmentLife);
     Fragment secondFragment =
         new Fragment(this.topLeft, new MatrixCoords(0, -1), FragmentLife);
     Fragment thirdFragment =
         new Fragment(this.topLeft, new MatrixCoords(0, 1), FragmentLife);
     Fragment fourthFragment =
         new Fragment(this.topLeft, new MatrixCoords(1, 0), FragmentLife);
     List<Fragment> array = new List<Fragment>();
     array.Add(firstFragment);
     array.Add(secondFragment);
     array.Add(thirdFragment);
     array.Add(fourthFragment);
     return array;
 }