Untitled
unknown
plain_text
3 years ago
1.9 kB
15
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 Button Season2;
public InputField clearIt;
public void submittingClear()
{
clearIt.text = "";
}
public void SetText(string text)
{
audioPlayer.Play();
Textfield.text = text;
}
void Awake()
{
int levelReached = PlayerPrefs.GetInt("levelReached", 1);
Debug.Log(levelReached.ToString());
if (levelReached > 5 && Season2 != null)
{
Season2.interactable = true;
}
if (Season2 != null)
{
GameManager.DeikseAdProtiFora = false;
}
}
public void Enter()
{
if (Textfield.text.ToLower().Trim().Replace(" ", "") == GameManager.LEVEL_SOLUTIONS[GameManager.CurrentLevel].ToLower().Trim().Replace(" ", ""))
{
audioPlayer.clip = clipWin;
Debug.Log("TO VRIKES AGORINA MOU BRAVO");
clearIt.text = "";
GameManager.DeikseAdProtiFora = true;
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...