update
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user