public int GetGridYOf(GameObject g) { return (int)g.GetBounds().Center.Y; }
public void RegisterGridObject(GameObject g) { Circle c = g.GetBounds(); int xMin = (int)(c.Center.X - c.Radius); int xMax = (int)(c.Center.X + c.Radius); int yMin = (int)(c.Center.Y - c.Radius); int yMax = (int)(c.Center.Y + c.Radius); xMin = (int)Math.Max(xMin, 0f); yMin = (int)Math.Max(yMin, 0f); xMax = (int)Math.Min(xMax, width-1); yMax = (int)Math.Min(yMax, height-1); for (int i = xMin; i <= xMax; i++) { for (int j = yMin; j <= yMax; j++) { objectMap[i, j].Add(g); } } }