I'm working in C# on a Unity 2D game that spawns a shape that has only one correct landing place. There are 7 basic shapes but the component 4 squares of each shape are unique, with each bearing, say, a unique number. There are many more than 7 unique shapes because any component square is unique to the shape set. So the shapes have squares bearing a unique number (1,2,3,4 on a square; 5,6,7,8 on another square; 9,10,11,12 in a line (I-shape), 13,14,15,16 in another line (I-shape), etc. each of these shapes must be moved (by dragging, dropping or rotating) to its particular place in the grid.
I need to swiftly (1) indicate whether a shape has landed correctly and, if not, (2) move the misplaced (and possibly mis-rotated) shape to its proper location so that remaining falling pieces are not blocked from attaining their correct placements.
For (1), I'm using a dictionary with a string for the key that identifies the square component of the shape and an integer 2D array for the grid location values. Here is the declaration:
Dictionary<string, int[,]> dictOfProperLocations = new Dictionary<string, int[,]>();
Visual Studio is OK with that. But I am unable so far to allocate key-value pairs to the dictionary. I've tried the following and variants to indicate that a straight shape (an I-shape) bearing the numbers 1-4 belongs at the origin at its left end and stretches straight to the right:
dictOfProperLocations.Add("1", [0,0]);
dictOfProperLocations.Add("2", [1,0]);
dictOfProperLocations.Add("3", [2,0]);
dictOfProperLocations.Add("4", [3,0]);
But Visual Studio objects to that. I find many examples for C# dictionaries with string-keys and 1D-array-values, but no examples for this case with 2D-array-values.
Or might this be better handled with a 2D Transform[,] for the values representing the proper grid locations? Thank you.