public override bool Place(Point origin, StructureMap structures)
 {
     if (!structures.CanPlace(new Rectangle(origin.X, origin.Y, _width, _height)))
     {
         return(false);
     }
     for (int i = 0; i < _width; i++)
     {
         for (int j = 0; j < _height; j++)
         {
             int num  = (_xMirror ? (-i) : i);
             int num2 = (_yMirror ? (-j) : j);
             if (_data[i, j] != -1 && !_actions[_data[i, j]].Apply(origin, num + origin.X, num2 + origin.Y))
             {
                 return(false);
             }
         }
     }
     structures.AddProtectedStructure(new Rectangle(origin.X, origin.Y, _width, _height));
     return(true);
 }
Beispiel #2
0
 public override bool Place(Point origin, StructureMap structures)
 {
     if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X, origin.Y, this._width, this._height), 0))
     {
         return(false);
     }
     for (int index1 = 0; index1 < this._width; ++index1)
     {
         for (int index2 = 0; index2 < this._height; ++index2)
         {
             int num1 = this._xMirror ? -index1 : index1;
             int num2 = this._yMirror ? -index2 : index2;
             if (this._data[index1, index2] != -1 && !this._actions[this._data[index1, index2]].Apply(origin, num1 + origin.X, num2 + origin.Y))
             {
                 return(false);
             }
         }
     }
     structures.AddProtectedStructure(new Microsoft.Xna.Framework.Rectangle(origin.X, origin.Y, this._width, this._height), 0);
     return(true);
 }