// Update is called once per frame void Update() { selectionTimer -= Time.deltaTime; if (selectionTimer <= 0.0f) { currentSelectedCard = (currentSelectedCard + 1) % 2; selectionTimer = selectionDuration; } if (currentSelectedCard == 0) { leftSelectionHightlight.SetActive(true); rightSelectionHighlight.SetActive(false); } else { leftSelectionHightlight.SetActive(false); rightSelectionHighlight.SetActive(true); } if (currentSelectedCard == 0) { soundSelecationHighlight.SetActive(true); menuSelectionHighlight.SetActive(false); } else { soundSelecationHighlight.SetActive(false); menuSelectionHighlight.SetActive(true); } // implement key press if (Input.GetKeyDown(KeyCode.RightArrow)) { GameCard currentCard = null; if (currentSelectedCard == 0) { currentCard = leftCardLocation.GetChild(leftCardLocation.childCount - 1).GetComponent <GameCard>(); //level successfully completed on left card if (leftCardLocation.childCount - 1 == 0 && cardCount > 1 && cardCount < 30) { //LevelSelector.levelPassed = true; SceneManager.LoadScene("WinGame 1"); Debug.Log("Win"); } } else { currentCard = rightCardLocation.GetChild(rightCardLocation.childCount - 1).GetComponent <GameCard>(); //level successfully completed on right card if (rightCardLocation.childCount - 1 == 0 && cardCount > 1 && cardCount < 30) { //LevelSelector.levelPassed = true; SceneManager.LoadScene("WinGame 1"); Debug.Log("Win"); } } cardCount += currentCard.cardValue; cardCountText.text = cardCount.ToString(); //game over if (cardCount < 1 || cardCount > 30) { //LevelSelector.levelPassed = false; SceneManager.LoadScene("GameOver 1"); Debug.Log("Game Over"); } currentCard.transform.SetParent(transform); currentCard.StartAnimation(); Destroy(currentCard.gameObject, 1.0f); } //MenuButton("LevelScene"); if (Input.GetKeyDown(KeyCode.LeftArrow)) { if (currentSelectedCard == 0) { gameSound.mute = !gameSound.mute; } else { SceneManager.LoadScene("StartMenu"); } } }