using System.Collections; using System.Collections.Generic; using UnityEngine; public class control : MonoBehaviour { public GameObject parent; public GameObject panelHasil; private int urutan = 0; private int jumlahPuzzleSelesai = 0; void Start() { } void Aktif(int a) { for (int i = 0; i < parent.transform.childCount; i++) { if (parent.transform.GetChild(i).gameObject.activeSelf) { urutan = i + a; } } if (urutan < 0) { urutan = parent.transform.childCount - 1; } else if (urutan >= parent.transform.childCount) { urutan = 0; } for (int i = 0; i < parent.transform.childCount; i++) { parent.transform.GetChild(i).gameObject.SetActive(false); } parent.transform.GetChild(urutan).gameObject.SetActive(true); feedback feedback = parent.transform.GetChild(urutan).GetComponent(); if (feedback != null) { feedback.selesai = false; if (jumlahPuzzleSelesai == 5) { if (panelHasil != null) { panelHasil.SetActive(true); } } } } public void CheckPuzzleCompletion() { jumlahPuzzleSelesai++; if (jumlahPuzzleSelesai == 5) { if (panelHasil != null) { panelHasil.SetActive(true); } } } private void OnMouseUp() { if (gameObject.name == "next") { Aktif(1); } else { Aktif(-1); } } void Update() { } }