private void MoveUp() { if (eventSystem.currentSelectedGameObject != null) { if (row2.Contains(eventSystem.currentSelectedGameObject)) { //select next card eventSystem.SetSelectedGameObject(row1[row2.IndexOf(eventSystem.currentSelectedGameObject)]); } else { if (row3.Contains(eventSystem.currentSelectedGameObject)) { //select next card eventSystem.SetSelectedGameObject(row2[row3.IndexOf(eventSystem.currentSelectedGameObject)]); } else { //play wall sound and deselect the card eventSystem.currentSelectedGameObject.GetComponent <Card>().PlayWallSound(); eventSystem.SetSelectedGameObject(null); lastKeyDown = possibleKeyDown.Up; } } } else { if (row3.Count == 0) { if (row2.Contains(lastselect) && (lastKeyDown == possibleKeyDown.Down)) { //select last card eventSystem.SetSelectedGameObject(row2[row2.IndexOf(lastselect)]); } else { //play wall sound lastselect.GetComponent <Card>().PlayWallSound(); } } else { if (row3.Contains(lastselect) && (lastKeyDown == possibleKeyDown.Down)) { //select last card eventSystem.SetSelectedGameObject(row3[row3.IndexOf(lastselect)]); } else { //play wall sound lastselect.GetComponent <Card>().PlayWallSound(); } } } }
private void doMoveRight(List <GameObject> row) { //get the index of card int cardIndex = row.IndexOf(eventSystem.currentSelectedGameObject); if (cardIndex == row.Count - 1) { //play wall sound and deselect the card eventSystem.currentSelectedGameObject.GetComponent <Card>().PlayWallSound(); eventSystem.SetSelectedGameObject(null); lastKeyDown = possibleKeyDown.Right; } else { //Select next card eventSystem.SetSelectedGameObject(row[cardIndex + 1]); } }
private void MoveRight() { if (eventSystem.currentSelectedGameObject != null) { if (row1.Contains(eventSystem.currentSelectedGameObject)) { //get the index of card int cardIndex = row1.IndexOf(eventSystem.currentSelectedGameObject); if (cardIndex == row1.Count - 1) { //play wall sound and deselect the card eventSystem.currentSelectedGameObject.GetComponent <Card>().PlayWallSound(); eventSystem.SetSelectedGameObject(null); lastKeyDown = possibleKeyDown.Right; } else { //Select next card eventSystem.SetSelectedGameObject(row1[cardIndex + 1]); } } else if (row2.Contains(eventSystem.currentSelectedGameObject)) { //get the index of card int cardIndex = row2.IndexOf(eventSystem.currentSelectedGameObject); if (cardIndex == row2.Count - 1) { //play wall sound and deselect the card eventSystem.currentSelectedGameObject.GetComponent <Card>().PlayWallSound(); eventSystem.SetSelectedGameObject(null); lastKeyDown = possibleKeyDown.Right; } else { //Select next card eventSystem.SetSelectedGameObject(row2[cardIndex + 1]); } } else if (row3.Contains(eventSystem.currentSelectedGameObject)) { //get the index of card int cardIndex = row3.IndexOf(eventSystem.currentSelectedGameObject); if (cardIndex == row3.Count - 1) { //play wall sound and deselect the card eventSystem.currentSelectedGameObject.GetComponent <Card>().PlayWallSound(); eventSystem.SetSelectedGameObject(null); lastKeyDown = possibleKeyDown.Right; } else { //Select next card eventSystem.SetSelectedGameObject(row3[cardIndex + 1]); } } } else { if (row1.Contains(lastselect)) { //get the index of card int cardIndex = row1.IndexOf(lastselect); if ((cardIndex != 0) || (lastKeyDown != possibleKeyDown.Left)) { //play wall sound lastselect.GetComponent <Card>().PlayWallSound(); } else { //Select next card eventSystem.SetSelectedGameObject(row1[cardIndex]); } } else if (row2.Contains(lastselect)) { //get the index of card int cardIndex = row2.IndexOf(lastselect); if ((cardIndex != 0) || (lastKeyDown != possibleKeyDown.Left)) { //play wall sound lastselect.GetComponent <Card>().PlayWallSound(); } else { //Select next card eventSystem.SetSelectedGameObject(row2[cardIndex]); } } else { //get the index of card int cardIndex = row3.IndexOf(lastselect); if ((cardIndex != 0) || (lastKeyDown != possibleKeyDown.Left)) { //play wall sound lastselect.GetComponent <Card>().PlayWallSound(); } else { //Select next card eventSystem.SetSelectedGameObject(row3[cardIndex]); } } } }