void QuerySetObjectsResetPosition() { foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); objectScript.SetGridPosition(new Vector3(StoragePosition.transform.position.x, StoragePosition.transform.position.y, -0.5f)); } }
void QuerySetMarkerObjectsPosition() { float xOffset = 0.42f * targetScale; float yOffset = 0f; int colCount = 0; int rowCount = 0; int noteIndex = 0; int[] notes = new int[Globals.MaxStrings + 1] { (int)Globals._notes.NOTE_E, (int)Globals._notes.NOTE_A, (int)Globals._notes.NOTE_D, (int)Globals._notes.NOTE_G, (int)Globals._notes.NOTE_B, (int)Globals._notes.NOTE_E, 0 }; int[] keySeqArray = new int[41] { 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 }; if (_drawMode == DrawMode.Guitar) { noteIndex = notes[colCount]; foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); float x = gridStartX + xOffset; float y = gridStartY + yOffset; objectScript.SetGridPosition(new Vector3(x, y, -0.5f)); objectScript.NoteName = noteIndex; yOffset += FretGridDY * targetScale; rowCount++; if (rowCount >= FretGridHeight) { rowCount = 0; yOffset = 0f; xOffset += FretGridDX * targetScale; colCount++; noteIndex = notes [colCount]; } else { noteIndex++; if (noteIndex >= 12) { noteIndex = 0; } } if (colCount >= FretGridWidth) { break; } } } else if (_drawMode == DrawMode.Piano) { int lastKey = 1; int keyIndex = 0; int count = KeyboardObjectList.Count; count--; noteIndex = (int)Globals._notes.NOTE_C; foreach (GameObject tObj in MarkerObjectList) { if (keyIndex < 41) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); float x = gridStartX + xOffset + 4f; float y = gridStartY + yOffset; GameObject key = KeyboardObjectList[count]; KeyBoardObj keyObjectScript = key.GetComponent <KeyBoardObj> (); Vector3 vpos = keyObjectScript.GetGridPosition(); if (keyObjectScript.isBlack == true) { vpos.x = vpos.x - 1f; } else { vpos.x = vpos.x + 1f; } objectScript.SetGridPosition(new Vector3(vpos.x, vpos.y, -0.5f)); objectScript.NoteName = noteIndex; int k = keySeqArray [keyIndex]; if (k == 0) { if (lastKey == 0) { yOffset += FretGridDY * targetScale; } else { yOffset += (FretGridDY / 2) * targetScale; } } else if (k == 1) { yOffset += (FretGridDY / 2) * targetScale; } noteIndex++; if (noteIndex >= 12) { noteIndex = 0; } count--; if (count < 0) { count = 0; } lastKey = k; keyIndex++; } else { break; } } } }