Add NamedParticle for detecting liquid particles in pan
This commit is contained in:
parent
de10219b74
commit
8fe605216c
@ -881,8 +881,9 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
|
|||||||
BTC.SpeechOutputEnded()
|
BTC.SpeechOutputEnded()
|
||||||
|
|
||||||
// Oel in Topf geben - ToDo: Particle Trigger
|
// Oel in Topf geben - ToDo: Particle Trigger
|
||||||
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Olivenoel")
|
BTC.Run("Particle.INTERACTABLES.Olivenoel")
|
||||||
BTC.Run("Collider.INTERACTABLES.Topf")
|
//BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Olivenoel")
|
||||||
|
//BTC.Run("Collider.INTERACTABLES.Topf")
|
||||||
BTC.Run("AudioSource.AUDIO.Kueche2allesgefund")
|
BTC.Run("AudioSource.AUDIO.Kueche2allesgefund")
|
||||||
|
|
||||||
// Herd anstellen - ToDo: Handling in Story?
|
// Herd anstellen - ToDo: Handling in Story?
|
||||||
|
87
Viagg-io/Assets/Packages/MyBT/BTC/Handlers/NamedParticle.cs
Normal file
87
Viagg-io/Assets/Packages/MyBT/BTC/Handlers/NamedParticle.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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
Loading…
x
Reference in New Issue
Block a user