Untitled

 avatar
unknown
plain_text
2 years ago
1.4 kB
3
Indexable
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class GameController: MonoBehaviour
{

    public Text Textfield;
    public AudioClip clipWin;
    public AudioClip clipFail;
    public AudioSource audioPlayer;
    public GameObject WinningPanel;

   

        public InputField clearIt;

        public void submittingClear()
        {
            clearIt.text = "";
        }

    public void SetText(string text)
    {
      
        audioPlayer.Play();
        Textfield.text = text;
    }


    public void Enter()
    {
        
        
        if (Textfield.text.ToLower() == GameManager.LEVEL_SOLUTIONS[GameManager.CurrentLevel])
        {
            audioPlayer.clip = clipWin;
            Debug.Log("TO VRIKES AGORINA MOU BRAVO");
            clearIt.text = "";
            WinningPanel.SetActive(true);
            if (PlayerPrefs.GetInt("levelReached", 1) == GameManager.CurrentLevel)
            {
                PlayerPrefs.SetInt("levelReached", GameManager.CurrentLevel + 1);
            }
            else
            {

            }
        }
        else
        {
            audioPlayer.clip = clipFail;
            Debug.Log("EKANES LATHOS FLORE");
            clearIt.text = "";
        }
        audioPlayer.Play();

    }

}
Editor is loading...