public void createAllLetters() { Vector3 startPos = originalCard.transform.position; // position of the first card, all cards will be offset from here int index = 0; for (int i = 0; i < letters.Length; i++) { if (i == 0) { letter = originalCard; } else { letter = Instantiate(originalCard) as initialSounds_settingsMouse; // letter = AddCom } //setLetter from the settingsMouse class, using the sprites provides and creating an id based on the i-iteration letter.setLetter(letters[index], i, letters[index].name); // allChoices[i] = letter; // add all of the letters into a list //print("My Curr Choices: " + theseLetters[i]); allLetterChoices.Add(letter); float posX = startPos.x + (i % gridCols) * offsetX; float posY = startPos.y + (int)Mathf.Floor((float)i / gridCols) * -offsetY; letter.transform.position = new Vector3(posX, posY, startPos.z); // create a new position based on this offset for the newly instatiated card // Center the remaining 4 letters positioning if (letters.Length - i < 5) { posX = startPos.x + (i % gridCols) * offsetX + 4; posY = startPos.y + (int)Mathf.Floor((float)i / gridCols) * -offsetY; } letter.transform.position = new Vector3(posX, posY, startPos.z); // create a new position based on this offset for the newly instatiated card //letterAppearance(letter, letters); // call the letterAppearance helper method to change how the letter is displayed if a user has already chosen it index++; } letterAppearance(allLetterChoices); }
public void lettersChosen(initialSounds_settingsMouse letter) { if (!userChoices.Contains(letter.getId())) { userChoices.Add(letter.getId()); isEmpty = false; alreadyChosen = false; } else if (userChoices.Contains(letter.getId())) { alreadyChosen = true; PlayerPrefs.DeleteKey(playerPrefName + letter.getId()); //Debug.Log("Deleted this key: " + playerPrefName + letter.getId()); userChoices.Remove(letter.getId()); //Debug.Log("Testing if we have this " + userChoices.Contains(letter.getId())); PlayerPrefs.Save(); } else if (userChoices.Count == 0) { isEmpty = true; // this variable will be passed into the playbutton screen, if it is set to true, do not allow the user to continue to the game screen } }
public void createVowels() { Vector3 startPos = new Vector3(-2.5f, originalCard.transform.position.y, originalCard.transform.position.z); // position of the first card, all cards will be offset from here int index = 0; for (int i = 0; i < vowelLetters.Length; i++) { if (i == 0) { letter = originalCard; } else { letter = Instantiate(originalCard) as initialSounds_settingsMouse; } //setLetter from the settingsMouse class, using the sprites provides and creating an id based on the i-iteration letter.setLetter(vowelLetters[index], i, vowelLetters[index].name); allLetterChoices.Add(letter); //print("My Curr Choices: " + theseLetters[i]); float posX = startPos.x + (i % gridCols) * offsetX; float posY = startPos.y + (int)Mathf.Floor((float)i / gridCols) * -offsetY; letter.transform.position = new Vector3(posX, posY, startPos.z); // create a new position based on this offset for the newly instatiated card // Center the remaining 4 letters positioning if (letters.Length - i < 5) { posX = startPos.x + (i % gridCols) * offsetX + 4; posY = startPos.y + (int)Mathf.Floor((float)i / gridCols) * -offsetY; } letter.transform.position = new Vector3(posX, posY, startPos.z); // create a new position based on this offset for the newly instatiated card index++; } letterAppearance(allLetterChoices); }