private void SpawnObjectTebak(GameObject obj) { GameObject go = Instantiate(obj, tileGridPanel.transform); ObjectTebak ot = go.GetComponent <ObjectTebak>(); //ot.hijaiyahContainer.sprite = spriteHijaiyah[hjyh]; //spawnedObjectsTebak.Add(go); }
private IEnumerator ShowTheImageFirst(GameObject obj) { ObjectTebak ot = obj.GetComponent <ObjectTebak>(); ot.frontCard.SetActive(true); ot.GetComponent <Button>().enabled = false; yield return(new WaitForSeconds(1.5f)); LeanTween.rotateY(obj, 90f, 0.5f); yield return(new WaitForSeconds(0.5f)); ot.frontCard.SetActive(false); LeanTween.rotateY(obj, 0f, 0.5f); ot.GetComponent <Button>().enabled = true; }
public void NewQuestion(int totalHijaiyah) { RemoveQuestion(); correctlyAnswered = 0; tileGridPanel.cellSize = new Vector2(settingSizeGrid[indexQuestion].x, settingSizeGrid[indexQuestion].y); GameObject[] temp = new GameObject[totalHijaiyah * 2]; spawnedObjectsTebak = new GameObject[totalHijaiyah * 2]; int n = 0; for (int i = 0; i < 2; i++) { for (int j = 0; j < totalHijaiyah; j++) { GameObject go = Instantiate(prefabTebakGambar, tileGridPanel.transform) as GameObject; ObjectTebak ot = go.GetComponent <ObjectTebak>(); ot.hijaiyahContainer.sprite = spriteHijaiyah[hijaiyahChoosen[j]]; temp[n] = go; temp[n].SetActive(false); n++; } } spawnedObjectsTebak = temp; spawnedObjectsTebak.Shuffle(); for (int i = 0; i < spawnedObjectsTebak.Length; i++) { GameObject gg = Instantiate(spawnedObjectsTebak[i], tileGridPanel.transform); gg.SetActive(true); gg.name = gg.name.Replace("(Clone)", string.Empty); spawnedObjectsTebak[i] = gg; StartCoroutine(ShowTheImageFirst(gg)); } //foreach (GameObject go in temp) //{ // Destroy(go); //} }