/// <summary> /// Checks that one of all ground position of a building are blocked. /// </summary> /// <param name="_building">Building to check.</param> /// <param name="_ground">Ground, where the building is right now.</param> /// <returns>Returns true if one ground of the building is blocked.</returns> private bool IsBuildingGroundsBlocked(Building _building, Ground _ground) { for (int y = 0; y < _building.CurrentHeightH; y++) { for (int x = 0; x < _building.CurrentWidthH; x++) { // current x and y position int xPosition = x + _ground.GetWidth; int yPosition = y + _ground.GetHeight; bool isUnitOnGround = IsUnitOnGround(xPosition, yPosition); if (MapGenerator.IsGroundBlocked(xPosition, yPosition) || isUnitOnGround) { return(true); } } } return(false); }
public void SetGround(Ground _ground) { _comeFromGround = _ground; }