public void berhasil()
 {
     Solved          = true;
     jalankan_sekali = true;
     centang.transform.localScale     = new Vector2(1, 1);
     nama_gambar.transform.localScale = new Vector2(1, 1);
     suara_menang.GetComponent <AudioSource>().Play();
     Image.GetComponent <GridLayoutGroup>().spacing = new Vector2(0, 0);
     Scene_management.unlockNextlevel_Puzzle();
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        switch (SceneManager.GetActiveScene().name)
        {
        case "Level_1":
            if (
                huruf[0].childCount > 0 &&
                huruf[1].childCount > 0 &&
                huruf[2].childCount > 0 &&
                huruf[3].childCount > 0 &&
                huruf[4].childCount > 0 &&
                jalankan_sekali == false
                )
            {
                string jawaban = "";
                foreach (Transform child in transform)
                {
                    jawaban += child.GetChild(0).name.Substring(6, 1);
                }
                if (jawaban == "CERAH")
                {
                    Scene_management.unlockNextlevel();
                    StartCoroutine(Benar());
                    wrong.SetActive(false);
                    jalankan_sekali = true;
                }
                else
                {
                    StartCoroutine(salah());
                    reset();
                }
            }
            break;

        case "Level_2":
            if (
                huruf[0].childCount > 0 &&
                huruf[1].childCount > 0 &&
                huruf[2].childCount > 0 &&
                huruf[3].childCount > 0 &&
                huruf[4].childCount > 0 &&
                jalankan_sekali == false
                )
            {
                string jawaban = "";
                foreach (Transform child in transform)
                {
                    jawaban += child.GetChild(0).name.Substring(6, 1);
                }
                if (jawaban == "HUJAN")
                {
                    Scene_management.unlockNextlevel();
                    StartCoroutine(Benar());
                    wrong.SetActive(false);
                    jalankan_sekali = true;
                }
                else
                {
                    StartCoroutine(salah());
                    reset();
                }
            }
            break;

        case "Level_3":
            if (
                huruf[0].childCount > 0 &&
                huruf[1].childCount > 0 &&
                huruf[2].childCount > 0 &&
                huruf[3].childCount > 0 &&
                huruf[4].childCount > 0 &&
                huruf[5].childCount > 0 &&
                jalankan_sekali == false
                )
            {
                string jawaban = "";
                foreach (Transform child in transform)
                {
                    jawaban += child.GetChild(0).name.Substring(6, 1);
                }
                if (jawaban == "BANJIR")
                {
                    Scene_management.unlockNextlevel();
                    StartCoroutine(Benar());
                    wrong.SetActive(false);
                    jalankan_sekali = true;
                }
                else
                {
                    StartCoroutine(salah());
                    reset();
                }
            }
            break;

        case "Level_4":
            if (
                huruf[0].childCount > 0 &&
                huruf[1].childCount > 0 &&
                huruf[2].childCount > 0 &&
                huruf[3].childCount > 0 &&
                huruf[4].childCount > 0 &&
                huruf[5].childCount > 0 &&
                huruf[6].childCount > 0 &&
                jalankan_sekali == false
                )
            {
                string jawaban = "";
                foreach (Transform child in transform)
                {
                    jawaban += child.GetChild(0).name.Substring(6, 1);
                }
                if (jawaban == "BERAWAN")
                {
                    Scene_management.unlockNextlevel();
                    StartCoroutine(Benar());
                    wrong.SetActive(false);
                    jalankan_sekali = true;
                }
                else
                {
                    StartCoroutine(salah());
                    reset();
                }
            }
            break;

        case "Level_5":
            if (
                huruf[0].childCount > 0 &&
                huruf[1].childCount > 0 &&
                huruf[2].childCount > 0 &&
                huruf[3].childCount > 0 &&
                huruf[4].childCount > 0 &&
                huruf[5].childCount > 0 &&
                huruf[6].childCount > 0 &&
                jalankan_sekali == false
                )
            {
                string jawaban = "";
                foreach (Transform child in transform)
                {
                    jawaban += child.GetChild(0).name.Substring(6, 1);
                }
                if (jawaban == "MENDUNG")
                {
                    Scene_management.unlockNextlevel();
                    StartCoroutine(Benar());
                    wrong.SetActive(false);
                    jalankan_sekali = true;
                }
                else
                {
                    StartCoroutine(salah());
                    reset();
                }
            }
            break;

        case "Level_6":
            if (
                huruf[0].childCount > 0 &&
                huruf[1].childCount > 0 &&
                huruf[2].childCount > 0 &&
                huruf[3].childCount > 0 &&
                huruf[4].childCount > 0 &&
                huruf[5].childCount > 0 &&
                huruf[6].childCount > 0 &&
                jalankan_sekali == false
                )
            {
                string jawaban = "";
                foreach (Transform child in transform)
                {
                    jawaban += child.GetChild(0).name.Substring(6, 1);
                }
                if (jawaban == "NELAYAN")
                {
                    Scene_management.unlockNextlevel();
                    StartCoroutine(Benar());
                    wrong.SetActive(false);
                    jalankan_sekali = true;
                }
                else
                {
                    StartCoroutine(salah());
                    reset();
                }
            }
            break;

        case "Level_7":
            if (
                huruf[0].childCount > 0 &&
                huruf[1].childCount > 0 &&
                huruf[2].childCount > 0 &&
                huruf[3].childCount > 0 &&
                huruf[4].childCount > 0 &&
                huruf[5].childCount > 0 &&
                huruf[6].childCount > 0 &&
                huruf[7].childCount > 0 &&
                huruf[8].childCount > 0 &&
                jalankan_sekali == false
                )
            {
                string jawaban = "";
                foreach (Transform child in transform)
                {
                    jawaban += child.GetChild(0).name.Substring(6, 1);
                }
                if (jawaban == "SEPAKBOLA")
                {
                    Scene_management.unlockNextlevel();
                    StartCoroutine(Benar());
                    wrong.SetActive(false);
                    jalankan_sekali = true;
                }
                else
                {
                    StartCoroutine(salah());
                    reset();
                }
            }
            break;

        case "Level_8":
            if (
                huruf[0].childCount > 0 &&
                huruf[1].childCount > 0 &&
                huruf[2].childCount > 0 &&
                huruf[3].childCount > 0 &&
                huruf[4].childCount > 0 &&
                huruf[5].childCount > 0 &&
                huruf[6].childCount > 0 &&
                huruf[7].childCount > 0 &&
                huruf[8].childCount > 0 &&
                huruf[9].childCount > 0 &&
                jalankan_sekali == false
                )
            {
                string jawaban = "";
                foreach (Transform child in transform)
                {
                    jawaban += child.GetChild(0).name.Substring(6, 1);
                }
                if (jawaban == "KEKERINGAN")
                {
                    StartCoroutine(Benar());
                    wrong.SetActive(false);
                    jalankan_sekali = true;
                }
                else
                {
                    StartCoroutine(salah());
                    reset();
                }
            }
            break;
        }
    }
 public void benar()
 {
     Correct = true;
     Scene_management.unlockNextlevel_Puzzle();
 }