63 lines
1.3 KiB
C#
63 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
public class feedback : MonoBehaviour
|
|
{
|
|
public GameObject membeku;
|
|
public bool selesai = false;
|
|
public static int score = 0;
|
|
public TextMeshProUGUI scoreText;
|
|
public TextMeshProUGUI scoreText2;
|
|
public bool skorSudahDiupdate = false;
|
|
|
|
void Start()
|
|
{
|
|
UpdateScoreText();
|
|
}
|
|
|
|
public void Cek()
|
|
{
|
|
if (skorSudahDiupdate) return;
|
|
|
|
bool semuaTertempel = true;
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
if (!transform.GetChild(i).GetComponent<drag>().on_tempel)
|
|
{
|
|
semuaTertempel = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (semuaTertempel)
|
|
{
|
|
score += 100;
|
|
skorSudahDiupdate = true;
|
|
UpdateScoreText();
|
|
membeku.SetActive(true);
|
|
selesai = true;
|
|
control controlScript = FindObjectOfType<control>();
|
|
if (controlScript != null)
|
|
{
|
|
controlScript.CheckPuzzleCompletion();
|
|
}
|
|
}
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (!selesai)
|
|
{
|
|
Cek();
|
|
}
|
|
}
|
|
|
|
public void UpdateScoreText()
|
|
{
|
|
scoreText.text = score.ToString();
|
|
scoreText2.text = score.ToString();
|
|
}
|
|
}
|