// using System.Collections; // using System.Collections.Generic; // using UnityEngine; // public class reset : MonoBehaviour // { // public GameObject parent_puzzle, senyum; // // Start is called before the first frame update // void Start() // { // } // void OnMouseUp() // { // for(int i=0; i < 4; i++){ // parent_puzzle.transform.GetChild(i).GetComponent ().on_tempel = false; // parent_puzzle.transform.GetChild(i).GetComponent ().on_pos = false; // parent_puzzle.transform.GetChild(i).position = parent_puzzle.transform.GetChild(i).GetComponent ().pos_awal; // parent_puzzle.transform.GetChild(i).localScale = parent_puzzle.transform.GetChild(i).GetComponent ().scale_awal; // } // senyum.SetActive (false); // parent_puzzle.GetComponent().selesai = false; // } // // Update is called once per frame // void Update() // { // } // } using System.Collections; using System.Collections.Generic; using UnityEngine; public class reset : MonoBehaviour { public GameObject parent_puzzle, senyum; void OnMouseUp() { int jumlahChild = parent_puzzle.transform.childCount; for (int i = 0; i < jumlahChild; i++) { Transform child = parent_puzzle.transform.GetChild(i); drag_puzzle puzzle = child.GetComponent(); if (puzzle != null) { puzzle.on_tempel = false; puzzle.on_pos = false; child.position = puzzle.pos_awal; child.localScale = puzzle.scale_awal; } } if (senyum != null) { senyum.SetActive(false); } feedback fb = parent_puzzle.GetComponent(); if (fb != null) { fb.selesai = false; } } }