BT FMOD function for looping sounds

dev
Nadine Ganz 2024-12-12 18:54:11 +01:00
parent 2fee855ece
commit 3e78857cdf
6 changed files with 627040 additions and 620107 deletions

View File

@ -7,7 +7,7 @@
//RunTree("32_Grotto_Kueche_Intro")
RunTree("32_Grotto_Kueche_Zwiebeln_schneiden")
//RunTree("32_Grotto_Kueche_alles_gefunden")
RunTree("32_Grotto_Kueche_alles_gefunden")
//RunTree("32_Grotto_Kueche_Kochen_Anzahl")
//RunTree("32_Grotto_Kueche_Zusammen_Kochen")
@ -607,6 +607,7 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
// Fail
//BTC.GetKeyDown("Space")
BTC.ListenToEvent("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
BTC.Wait(1)
BTC.CompareBool("RisottoIsSnapped", false)
// Objekt geht zurueck
@ -635,10 +636,11 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
Composite(Sequence) {
// Fail
BTC.ListenToEvent("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Salz")
BTC.Wait(1)
BTC.CompareBool("SalzIsSnapped", false)
// Objekt geht zurueck
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Salz", -6.824, 1.335, -18.8996)
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Salz", -6.607, 1.321, -18.8996)
BTC.SynthesizeText("Das hast du an den falschen Ort gestellt.")
BTC.SpeechOutputEnded()
@ -663,10 +665,11 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
Composite(Sequence) {
// Fail
BTC.ListenToEvent("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Pfeffer")
BTC.Wait(1)
BTC.CompareBool("PfefferIsSnapped", false)
// Objekt geht zurueck
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Pfeffer", -6.824, 1.335, -18.8996)
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Pfeffer", -6.686, 1.321, -18.8996)
BTC.SynthesizeText("Das hast du an den falschen Ort gestellt.")
BTC.SpeechOutputEnded()
@ -691,10 +694,11 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
Composite(Sequence) {
// Fail
BTC.ListenToEvent("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
BTC.Wait(1)
BTC.CompareBool("WeissweinIsSnapped", false)
// Objekt geht zurueck
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein", -6.824, 1.335, -18.8996)
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein", -6.58, 1.451, -19.0233)
BTC.SynthesizeText("Das hast du an den falschen Ort gestellt.")
BTC.SpeechOutputEnded()
@ -719,10 +723,11 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
Composite(Sequence) {
// Fail
BTC.ListenToEvent("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
BTC.Wait(1)
BTC.CompareBool("BouillonIsSnapped", false)
// Objekt geht zurueck
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon", -6.824, 1.335, -18.8996)
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon", -6.947, 1.402, -18.995)
BTC.SynthesizeText("Das hast du an den falschen Ort gestellt.")
BTC.SpeechOutputEnded()
@ -747,10 +752,11 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
Composite(Sequence) {
// Fail
BTC.ListenToEvent("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Olivenoel")
BTC.Wait(1)
BTC.CompareBool("OlivenoelIsSnapped", false)
// Objekt geht zurueck
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Olivenoel", -6.824, 1.335, -18.8996)
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Olivenoel", -6.752, 1.449, -19.024)
BTC.SynthesizeText("Das hast du an den falschen Ort gestellt.")
BTC.SpeechOutputEnded()
@ -784,12 +790,11 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
// Oel in Topf geben - Particle Trigger
// ...
BTC.Run("AudioSource.AUDIO.Kueche2Fallesgefun")
//BTC.GetKeyDown("Return")
// Zwiebeln in Topf geben
BTC.Run("NamedGrabEvent.INTERACTABLES.Zwiebeln")
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Zwiebeln")
BTC.Run("Collider.INTERACTABLES.Topf")
BTC.Start("StudioEventEmitter.STATIC.Herdplatte")
BTC.Run("AudioSource.AUDIO.Kueche3Fallesgefun")
// Frage beantworten

View File

@ -276,6 +276,30 @@ public class BTC : MonoBehaviour {
Task.SetSucceeded();
}
}
[Task]
public void Start(string objectName)
{
List<ComponentHandler> handlers = GetHandlers(objectName);
handlers.ForEach(handler => handler.Start(Task.getState));
if (handlers.Count == 0)
{
Debug.LogWarning($"BTC.Start: no components under the name '{objectName}'");
Task.SetSucceeded();
}
}
[Task]
public void Stop(string objectName)
{
List<ComponentHandler> handlers = GetHandlers(objectName);
handlers.ForEach(handler => handler.Stop(Task.getState));
if (handlers.Count == 0)
{
Debug.LogWarning($"BTC.Stop: no components under the name '{objectName}'");
Task.SetSucceeded();
}
}
#endregion
#region video & sound tasks

View File

@ -220,6 +220,22 @@ public class ComponentHandler : MonoBehaviour {
}
}
public virtual void Start(MyBT.NodeState nodeState)
{
if (Task.isDebugging)
{
Debug.LogWarning($"ComponentHandler.Start: not implemented for {this.GetType()}");
}
}
public virtual void Stop(MyBT.NodeState nodeState)
{
if (Task.isDebugging)
{
Debug.LogWarning($"ComponentHandler.Stop: not implemented for {this.GetType()}");
}
}
protected float sourceAlpha;
protected float targetAlpha;
protected float timeSum;

View File

@ -92,8 +92,40 @@ public class NamedStudioEventEmitter : ComponentHandler {
}
}
}
public override void Start(MyBT.NodeState nodeState)
{
if (nodeState == NodeState.Aborting)
{
studioEventEmitter.Stop();
return;
}
if (nodeState == NodeState.FirstRun)
{
studioEventEmitter.Play();
Task.SetSucceeded();
return;
}
}
public override void Stop(MyBT.NodeState nodeState)
{
if (nodeState == NodeState.Aborting)
{
studioEventEmitter.Stop();
return;
}
if (nodeState == NodeState.FirstRun)
{
studioEventEmitter.Stop();
Task.SetSucceeded();
return;
}
}
#else
[Header("FMod Support disabled: Window->MyBT->PreCompiler Definitions")]
public string dummy;
#endif
}
}

File diff suppressed because it is too large Load Diff

View File

@ -140,9 +140,6 @@ PlayerSettings:
bundleVersion: 0.1
preloadedAssets:
- {fileID: 11400000, guid: be340e3c48769439d8d18a5a2bccd498, type: 2}
- {fileID: 11400000, guid: bfa1182bd221b4ca89619141f66f1260, type: 2}
- {fileID: -8196854396901781169, guid: 1a4c68ca72a83449f938d669337cb305, type: 2}
- {fileID: -64324148185763206, guid: a9a6963505ddf7f4d886008c6dc86122, type: 2}
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1