Initialer Upload neues Unity-Projekt

This commit is contained in:
Daniel Ocks
2025-07-03 11:02:29 +02:00
commit 27d6b94b7c
8167 changed files with 1116569 additions and 0 deletions

View File

@ -0,0 +1,33 @@
using UnityEngine;
public class ConvaiSpeechBubbleController : MonoBehaviour
{
ConvaiGroupNPCController _convaiGroupNPC;
NPCSpeechBubble _speechBubble;
public void Initialize(NPCSpeechBubble speechBubbleDisplay, ConvaiGroupNPCController convaiGroupNPC)
{
if (_speechBubble != null) return;
_speechBubble = Instantiate(speechBubbleDisplay, transform);
_convaiGroupNPC = convaiGroupNPC;
_convaiGroupNPC.ShowSpeechBubble += ConvaiNPC_ShowSpeechBubble;
_convaiGroupNPC.HideSpeechBubble += ConvaiNPC_HideSpeechBubble;
}
private void ConvaiNPC_HideSpeechBubble()
{
_speechBubble.HideSpeechBubble();
}
private void ConvaiNPC_ShowSpeechBubble(string text)
{
_speechBubble.ShowSpeechBubble(text);
}
void OnDestroy()
{
_convaiGroupNPC.ShowSpeechBubble -= ConvaiNPC_ShowSpeechBubble;
_convaiGroupNPC.HideSpeechBubble -= ConvaiNPC_HideSpeechBubble;
Destroy(_speechBubble.gameObject);
_speechBubble = null;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e4c8a9e9735c471493ad93d4f677e7de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
/// <summary>
/// Interface for displaying speech bubbles.
/// </summary>
public interface ISpeechBubbleDisplay
{
void ShowSpeechBubble(string text);
void HideSpeechBubble();
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6c1403fe2d584d4abbb9e6588b8035f7
timeCreated: 1712719388

View File

@ -0,0 +1,26 @@
using TMPro;
using UnityEngine;
public class NPCSpeechBubble : MonoBehaviour, ISpeechBubbleDisplay
{
[SerializeField] private TMP_Text speechBubbleText;
[SerializeField] private Canvas speechBubbleCanvas;
/// <summary>
/// Show the speech bubble with the given text.
/// </summary>
/// <param name="text"> The text to display in the speech bubble. </param>
public void ShowSpeechBubble(string text)
{
speechBubbleText.text = text;
speechBubbleCanvas.enabled = true;
}
/// <summary>
/// Hide the speech bubble.
/// </summary>
public void HideSpeechBubble()
{
speechBubbleCanvas.enabled = false;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8a26c5b33822429bb443f94d041a3374
timeCreated: 1712719408