Add NamedParticle for detecting liquid particles in pan

This commit is contained in:
Nadine Ganz 2025-03-10 16:20:34 +01:00
parent de10219b74
commit 8fe605216c
4 changed files with 971720 additions and 971545 deletions

View File

@ -881,8 +881,9 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
BTC.SpeechOutputEnded()
// Oel in Topf geben - ToDo: Particle Trigger
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Olivenoel")
BTC.Run("Collider.INTERACTABLES.Topf")
BTC.Run("Particle.INTERACTABLES.Olivenoel")
//BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Olivenoel")
//BTC.Run("Collider.INTERACTABLES.Topf")
BTC.Run("AudioSource.AUDIO.Kueche2allesgefund")
// Herd anstellen - ToDo: Handling in Story?

View File

@ -0,0 +1,87 @@
//============= Copyright (c) Ludic GmbH, All rights reserved. ==============
//
// Purpose: Part of the My Behaviour Tree Controller Code
//
//=============================================================================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using MyBT;
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor(typeof(NamedParticle))]
public class NamedParticleInspector : ComponentHandlerInspector
{
}
#endif
[System.Serializable]
public class NamedParticle : ComponentHandler
{
public override string TypeLabel()
{
return "Particle";
}
public override string ContentLabel()
{
UpdateComponent();
return objName;
}
public override void UpdateComponent()
{
base.UpdateComponent();
_particleSys = GetComponent<ParticleSystem>();
}
public string objName = "ParticleXY";
private ParticleSystem _particleSys;
private List<ParticleSystem.Particle> _enteredParticles = new List<ParticleSystem.Particle>();
private bool _enteredTrigger = false;
public override string[][] helpText
{
get
{
return new string[][] {
new string[] {"Run", "Return Success on Trigger Event", $"BTC.Run(\"{roomId}\", \"{gameObject.name}\")"},
};
}
}
public override void Run(NodeState nodeState)
{
switch (nodeState)
{
case NodeState.FirstRun:
_enteredTrigger = false;
break;
case NodeState.Running:
if (_enteredTrigger)
{
Task.SetSucceeded();
}
break;
case NodeState.Aborting:
_enteredTrigger = false;
break;
}
}
private void OnParticleTrigger()
{
// Get particles that entered the trigger
int numEnter = _particleSys.GetTriggerParticles(ParticleSystemTriggerEventType.Enter, _enteredParticles);
if (numEnter > 0)
{
_enteredTrigger = true;
}
}
}

View File

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

File diff suppressed because it is too large Load Diff