Changes in BT Grotto kitchen, changed handlers

story_process
Nadine Ganz 2024-08-21 17:15:24 +02:00
parent 90c7327946
commit 1f7a3befdb
9 changed files with 148361 additions and 145456 deletions

View File

@ -1,8 +1,9 @@
Tree("Root") {
Composite(Sequence) {
// RunTree("32_Grotto_Kueche_Intro")
RunTree("32_Grotto_Kueche_Zwiebeln_schneiden")
RunTree("32_Grotto_Kueche_alles_gefunden")
//RunTree("32_Grotto_Kueche_Intro")
//RunTree("32_Grotto_Kueche_Zwiebeln_schneiden")
// RunTree("32_Grotto_Kueche_alles_gefunden")
RunTree("32_Grotto_Kueche_Zusammen_Kochen")
}
}
@ -11,9 +12,9 @@ Tree("32_Grotto_Kueche_Intro") {
BTC.Run("AudioSource.AUDIO.Kueche1FIntro")
// Schuerze greifen
//BTC.GetKeyDown("Return")
BTC.Run("GO/NamedGrabEvent.INTERACTABLES.Schuerze")
BTC.Hide("GO/NamedGrabEvent.INTERACTABLES.Schuerze")
//BTC.GetKeyDown("Return")
BTC.Run("AudioSource.AUDIO.Kueche2FIntro")
// Rezept vorlesen: Button Klick
@ -24,6 +25,7 @@ Tree("32_Grotto_Kueche_Intro") {
Composite(Sequence) {
// auf Button klicken
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
//BTC.GetKeyDown("Return")
}
Composite(Sequence) {
// keine Reaktion
@ -37,25 +39,26 @@ Tree("32_Grotto_Kueche_Intro") {
BTC.Run("AudioSource.AUDIO.Kueche3FIntro")
// Pilze leuchten
BTC.Show("NamedGrabEvent/NamedOutline.INTERACTABLES.Steinpilze")
BTC.Enable("NamedGrabEvent/NamedOutline.INTERACTABLES.Steinpilze")
Composite(Race) {
Composite(Sequence) {
// Pilze ins Wasser Glas legen
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Steinpilze")
BTC.Set("Collider.INTERACTABLES.GlassWasser", "otherTag", "Steinpilze")
BTC.Run("Collider.INTERACTABLES.GlassWasser")
BTC.Set("Collider.INTERACTABLES.GlassWasserTrigger", "otherTag", "Steinpilze")
BTC.Run("Collider.INTERACTABLES.GlassWasserTrigger")
}
Composite(Sequence) {
// Keine Reaction
BTC.Wait(5)
BTC.Run("AudioSource.AUDIO.Kueche1FSteinpilze")
// Pilze ins Wasser Glas legen
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Steinpilze")
BTC.Set("Collider.INTERACTABLES.GlassWasser", "otherTag", "Steinpilze")
BTC.Run("Collider.INTERACTABLES.GlassWasser")
BTC.Set("Collider.INTERACTABLES.GlassWasserTrigger", "otherTag", "Steinpilze")
BTC.Run("Collider.INTERACTABLES.GlassWasserTrigger")
}
}
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Steinpilze")
BTC.Disable("NamedGrabEvent/NamedOutline.INTERACTABLES.Steinpilze")
}
}
@ -70,17 +73,17 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
// Zutaten leuchten
Composite(Marathon) {
BTC.Show("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
BTC.Enable("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
BTC.Show("GO/NamedSocketEvent.SOCKETS.BouillonSocket")
BTC.Show("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
BTC.Enable("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
BTC.Show("GO/NamedSocketEvent.SOCKETS.WeissweinSocket")
BTC.Show("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
BTC.Enable("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
BTC.Show("GO/NamedSocketEvent.SOCKETS.RisottoSocket")
BTC.Show("NamedGrabEvent/NamedOutline.INTERACTABLES.Olivenoel")
BTC.Enable("NamedGrabEvent/NamedOutline.INTERACTABLES.Olivenoel")
BTC.Show("GO/NamedSocketEvent.SOCKETS.OlivenoelSocket")
BTC.Show("NamedGrabEvent/NamedOutline.INTERACTABLES.Pfeffer")
BTC.Enable("NamedGrabEvent/NamedOutline.INTERACTABLES.Pfeffer")
BTC.Show("GO/NamedSocketEvent.SOCKETS.PfefferSocket")
BTC.Show("NamedGrabEvent/NamedOutline.INTERACTABLES.Salz")
BTC.Enable("NamedGrabEvent/NamedOutline.INTERACTABLES.Salz")
BTC.Show("GO/NamedSocketEvent.SOCKETS.SalzSocket")
}
@ -91,23 +94,26 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
Decorator (RepeatUntilFailed) {
Decorator(Inverter) {
Composite(Sequence) {
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
BTC.CompareEventTriggered("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto", "SelectEnter", "true")
BTC.Run("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
//BTC.GetKeyDown("Return")
Composite(Race) {
Composite(Sequence) {
// Success
BTC.Run("GO/NamedSocketEvent.SOCKETS.RisottoSocket")
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
BTC.Disable("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
BTC.SetBool("IsSnapped")
}
Composite(Sequence) {
// Fail
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
BTC.CompareEventTriggered("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto", "SelectExit", "true")
BTC.Wait(2)
BTC.Run("AudioSource.AUDIO.Kueche2FZwiebelnsc")
// Objekt geht zurueck
BTC.Run("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
Composite(Marathon) {
BTC.Run("AudioSource.AUDIO.Kueche2FZwiebelnsc")
// Objekt geht zurueck
BTC.SetPosition("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto", -6.733, 1.362, -18.908)
}
BTC.SetBool("IsSnapped", false)
}
}
@ -121,31 +127,31 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
Composite(Sequence) {
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Salz")
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Salz")
BTC.Disable("NamedGrabEvent/NamedOutline.INTERACTABLES.Salz")
BTC.Run("GO/NamedSocketEvent.SOCKETS.SalzSocket")
}
Composite(Sequence) {
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Pfeffer")
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Pfeffer")
BTC.Disable("NamedGrabEvent/NamedOutline.INTERACTABLES.Pfeffer")
BTC.Run("GO/NamedSocketEvent.SOCKETS.PfefferSocket")
}
Composite(Sequence) {
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
BTC.Disable("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
BTC.Run("GO/NamedSocketEvent.SOCKETS.WeissweinSocket")
}
Composite(Sequence) {
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
BTC.Disable("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
BTC.Run("GO/NamedSocketEvent.SOCKETS.BouillonSocket")
}
Composite(Sequence) {
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Olivenoel")
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Olivenoel")
BTC.Disable("NamedGrabEvent/NamedOutline.INTERACTABLES.Olivenoel")
BTC.Run("GO/NamedSocketEvent.SOCKETS.OlivenoelSocket")
}
}
@ -271,7 +277,7 @@ Tree("32_Grotto_Kueche_Zusammen_Kochen") {
BTC.Run("AudioSource.AUDIO.Kueche1FZusammenKo")
// Risotto in Topf geben
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
BTC.Run("GO/NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Risotto")
BTC.Run("Collider.INTERACTABLES.Topf")
@ -279,36 +285,76 @@ Tree("32_Grotto_Kueche_Zusammen_Kochen") {
BTC.Run("NamedGrabEvent.INTERACTABLES.Loeffel")
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Loeffel")
BTC.Run("Collider.INTERACTABLES.Topf")
// Wie lange ruehren?
BTC.Wait(2)
BTC.Run("AudioSource.AUDIO.Kueche2FZusammenKo")
// Wein leuchtet
BTC.Show("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
BTC.Enable("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
// Wein greifen
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
BTC.Disable("NamedGrabEvent/NamedOutline.INTERACTABLES.Weisswein")
// Wein in Topf giessen
// ...
BTC.Run("AudioSource.AUDIO.Kueche3FZusammenKo")
// Wasserkocher leuchtet
BTC.Show("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
// Bouillon leuchtet
BTC.Enable("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
// Bouillon greifen
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
BTC.Disable("NamedGrabEvent/NamedOutline.INTERACTABLES.Bouillon")
// Bouillon in Topf geben
// ...
BTC.Run("AudioSource.AUDIO.Kueche4FZusammenKo")
// Glas Wasser mit Steinpilze in Topf geben
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Steinpilze")
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Steinpilze")
BTC.Run("Collider.INTERACTABLES.Topf")
}
}
Tree("32_Grotto_Kueche_Selbststaendig_Kochen") {
Composite(Sequence) {
BTC.Run("AudioSource.AUDIO.Kueche1FSelbststae")
// Selbstaendig kochen...
// ...
RunTree("32_Grotto_Kueche_Parmigiano")
}
}
Tree("32_Grotto_Kueche_Parmigiano") {
BTC.Run("AudioSource.AUDIO.Kueche4FZusammenKo") // Richtige Audio fehlt
// Parmigiano in Topf geben
// ...
BTC.Run("AudioSource.AUDIO.Kueche4FZusammenKo") // Richtige Audio fehlt
// Antwort User
BTC.Set("TextMeshPro.HANDMENU.Option1Button", "text", "Ja")
BTC.Show("GO.HANDMENU.Option1Button")
Composite(Race) {
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
BTC.Wait(5)
}
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Run("AudioSource.AUDIO.Kueche4FZusammenKo") // Richtige Audio fehlt
// Stelle für Pfanne leuchtet
// ...
// Pfanne rueber stellen
// ...
BTC.Run("AudioSource.AUDIO.Kueche5FZusammenKo")
BTC.Run("AudioSource.AUDIO.Kueche6FZusammenKo")
@ -325,14 +371,7 @@ Tree("32_Grotto_Kueche_Zusammen_Kochen") {
}
BTC.Hide("GO.HANDMENU.Option1Button")
BTC.Run("AudioSource.AUDIO.Kueche3GOutro")
}
}
Tree("32_Grotto_Kueche_Selbststaendig_Kochen") {
Composite(Sequence) {
BTC.Run("AudioSource.AUDIO.Kueche1FSelbststae")
// Selbstaendig kochen...
}
// BTC.Run(Audio)
}

View File

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

View File

@ -180,6 +180,33 @@ public class ComponentHandler : MonoBehaviour {
Task.SetError();
}
public virtual void Enable(MyBT.NodeState nodeState)
{
if (Task.isDebugging)
{
Debug.LogWarning($"ComponentHandler.Enable: not implemented for {this.GetType()}");
}
Task.SetError();
}
public virtual void Disable(MyBT.NodeState nodeState)
{
if (Task.isDebugging)
{
Debug.LogWarning($"ComponentHandler.Disable: not implemented for {this.GetType()}");
}
Task.SetError();
}
public virtual void SetPosition(MyBT.NodeState nodeState, float newX, float newY, float newZ)
{
if (Task.isDebugging)
{
Debug.LogWarning($"ComponentHandler.SetPosition: not implemented for {this.GetType()}");
}
Task.SetError();
}
protected float sourceAlpha;
protected float targetAlpha;
protected float timeSum;

View File

@ -31,12 +31,10 @@ public class NamedCollider : ComponentHandler {
public override void UpdateComponent() {
base.UpdateComponent();
colliderComponent = GetComponent<Collider>();
rigidbodyComponent = GetComponent<Rigidbody>();
}
public Collider colliderComponent;
public string objName = "ColliderXY";
public Rigidbody rigidbodyComponent;
private bool _collidedWithObj = false;
private string _otherColliderTag = "";
@ -68,10 +66,6 @@ public class NamedCollider : ComponentHandler {
colliderComponent.enabled = true;
Task.SetSucceeded();
}
// during runtime
if (nodeState == NodeState.Running) {
}
}
public override void Hide (MyBT.NodeState nodeState) {
@ -86,10 +80,6 @@ public class NamedCollider : ComponentHandler {
colliderComponent.enabled = false;
Task.SetSucceeded();
}
// during runtime
if (nodeState == NodeState.Running) {
}
}
public override void Run(NodeState nodeState)
@ -98,35 +88,18 @@ public class NamedCollider : ComponentHandler {
{
case NodeState.FirstRun:
_collidedWithObj = false;
colliderComponent.isTrigger = true;
if (rigidbodyComponent != null)
{
rigidbodyComponent.isKinematic = true;
}
break;
case NodeState.Running:
if (_collidedWithObj)
{
Task.SetSucceeded();
_otherColliderTag = "";
colliderComponent.isTrigger = false;
if (rigidbodyComponent != null)
{
rigidbodyComponent.isKinematic = false;
}
}
break;
case NodeState.Aborting:
colliderComponent.isTrigger = false;
_collidedWithObj = false;
_otherColliderTag = "";
if (rigidbodyComponent != null)
{
rigidbodyComponent.isKinematic = false;
}
break;
}
}

View File

@ -81,6 +81,16 @@ public class NamedGameObject : ComponentHandler {
}
}
public override void SetPosition(NodeState nodeState, float newX, float newY, float newZ)
{
if ((nodeState == NodeState.FirstRun) || (nodeState == NodeState.Running))
{
Vector3 newPos = new Vector3(newX, newY, newZ);
gameObject.transform.localPosition = newPos;
Task.SetSucceeded();
}
}
public GameObject go;
public string objName = "GoXY";
}

View File

@ -93,44 +93,4 @@ public class NamedGrabEvent : ComponentHandler {
return;
}
}
[Task]
public void CompareEventTriggered(MyBT.NodeState nodeState, string key, bool value)
{
if ((nodeState == NodeState.FirstRun) || (nodeState == NodeState.Running))
{
if (key == "SelectEnter")
{
if (selectEnterTriggered == value)
{
Debug.Log($"CompareEventTriggered {key} with {value} = equal");
Task.SetSucceeded();
return;
}
else
{
Debug.Log($"CompareEventTriggered {key} with {value} = not equal");
Task.SetFailed();
return;
}
}
else if (key == "SelectExit")
{
if (selectExitTriggered == value)
{
Debug.Log($"CompareEventTriggered {key} with {value} = equal");
Task.SetSucceeded();
return;
}
else
{
Debug.Log($"CompareEventTriggered {key} with {value} = not equal");
Task.SetFailed();
return;
}
}
Task.SetFailed();
}
}
}

View File

@ -30,7 +30,7 @@ public class NamedOutline : ComponentHandler
outlineComponent = GetComponent<Outline>();
}
public override void Show(MyBT.NodeState nodeState)
public override void Enable(NodeState nodeState)
{
if ((nodeState == NodeState.FirstRun) || (nodeState == NodeState.Running))
{
@ -39,7 +39,7 @@ public class NamedOutline : ComponentHandler
}
}
public override void Hide(MyBT.NodeState nodeState)
public override void Disable(MyBT.NodeState nodeState)
{
if ((nodeState == NodeState.FirstRun) || (nodeState == NodeState.Running))
{
@ -53,8 +53,8 @@ public class NamedOutline : ComponentHandler
get
{
return new string[][] {
new string[] {"Show", $"BTC.Show(\"{gameObject.name}\")"},
new string[] {"Hide", $"BTC.Hide(\"{gameObject.name}\")"}
new string[] {"Enable", $"BTC.Enable(\"{gameObject.name}\")"},
new string[] {"Disable", $"BTC.Disable(\"{gameObject.name}\")"}
};
}
}

View File

@ -1 +1 @@
2024-08-15T11:59:47.5584550Z
2024-08-21T14:48:22.4621020Z

File diff suppressed because it is too large Load Diff