public void addGameObject(IGameObject obj) { if (obj.getSize().X > chunkSize.X || obj.getSize().Y > chunkSize.Y) { throw new ArgumentException( "Object width and height must be less than logicScreenResolution"); } int x = (int)obj.getPosLeftTop().X / chunkSize.X; int y = (int)obj.getPosLeftTop().Y / chunkSize.Y; if (x < 0 || x > numberOfChanks.X || y < 0 || y > numberOfChanks.Y) { throw new ArgumentException("Object position exceed map size"); } chunks[x, y].addGameObject(obj); }