26 lines
609 B
C#
26 lines
609 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class QuestionTrigger : MonoBehaviour
|
|
{
|
|
public Test test;
|
|
public int questionIndex; // index pertanyaan untuk trigger ini
|
|
public Damageable damage;
|
|
private bool hasShownQuestion = false;
|
|
|
|
private void Start()
|
|
{
|
|
test = FindObjectOfType<Test>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (damage != null && !damage.IsAlive && !hasShownQuestion)
|
|
{
|
|
test.ShowQuestion(questionIndex);
|
|
hasShownQuestion = true; // agar hanya muncul sekali
|
|
}
|
|
}
|
|
}
|