Пример #1
0
        public void Update(IBuilding building)
        {
            var objectOnMapArea = _buildingAreaGetter.Get(building);

            for (int x = objectOnMapArea.MinX; x < objectOnMapArea.MaxX; x++)
            {
                for (int y = objectOnMapArea.MinY; y < objectOnMapArea.MaxY; y++)
                {
                    _mapLayerMatrixManager.Add(_mapLayerMatrixBuildings, (short)x, (short)y, 0, 1);
                }
            }
        }
Пример #2
0
        public bool IsColliding(IBuilding building)
        {
            var buildingArea = _buildingAreaGetter.Get(building);

            for (int x = buildingArea.MinX; x < buildingArea.MaxX; x++)
            {
                for (int y = buildingArea.MinY; y < buildingArea.MaxY; y++)
                {
                    if (_mapLayerMatrixManager.Get(_mapLayerMatrixBuildings, (short)x, (short)y) != 0)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }