private void SideMove(int dir) { lastMoveTime = Time.time; Vector2 disp = new Vector2(dir, 0); List <GameObject> markerList = new List <GameObject>(markers.Keys); foreach (GameObject marker in markerList) { if ((markers[marker].x + dir >= width || markers[marker].x + dir < 0) || treeGrid.Occupied(markers[marker] + disp)) { return; } } foreach (GameObject marker in markerList) { marker.transform.position = marker.transform.position + (Vector3)(gridSpacing * disp); markers[marker] = markers[marker] + disp; } }