This commit is contained in:
2026-06-05 21:24:41 +07:00
parent 91183760fb
commit 98806b862d
16 changed files with 6386 additions and 3028 deletions

View File

@@ -67,12 +67,17 @@ public class GerminiNPC : MonoBehaviour
string prompt = $"Ta muốn bán cho ông món đồ này: {playerHeldItem}";
Hallucinate.AI.GeminiService.Instance.GetResponse(npcPersona, prompt, (response) => {
Debug.Log($"<color=green>Tom:</color> {response}");
string finalMsg = response;
try {
DialogueResult result = JsonUtility.FromJson<DialogueResult>(response);
finalMsg = result.text;
} catch { }
Debug.Log($"<color=green>Tom:</color> {finalMsg}");
AudioManager.Instance?.Play(responseSound, position: transform.position);
// Nếu có ChatBubble gắn kèm thì hiển thị luôn
var bubble = GetComponentInChildren<Hallucinate.UI.ChatBubble>(true);
if (bubble != null) bubble.Show(response);
if (bubble != null) bubble.Show(finalMsg);
});
yield break;