Merge branch 'master' into leveldesign

This commit is contained in:
Dominik Gut 2025-03-11 15:39:46 +01:00
commit 84854d4290
16 changed files with 472 additions and 1113056 deletions

BIN
Viagg-io/Assets/Audio/FMOD/Allgemein.bank Normal file → Executable file

Binary file not shown.

0
Viagg-io/Assets/Audio/FMOD/Grotto_Essen.bank Normal file → Executable file
View File

0
Viagg-io/Assets/Audio/FMOD/Grotto_Kueche.bank Normal file → Executable file
View File

BIN
Viagg-io/Assets/Audio/FMOD/Master.bank Normal file → Executable file

Binary file not shown.

BIN
Viagg-io/Assets/Audio/FMOD/Master.strings.bank Normal file → Executable file

Binary file not shown.

BIN
Viagg-io/Assets/Audio/FMOD/Picknick.Baeckerei.bank Normal file → Executable file

Binary file not shown.

0
Viagg-io/Assets/Audio/FMOD/SBB.bank Normal file → Executable file
View File

View File

@ -12,9 +12,9 @@
}
Composite(Sequence) {
RunTree("32_Grotto_Story_B_Grotto_Intro")
//RunTree("32_Grotto_Story_B_Grotto_Intro")
//RunTree("32_Grotto_Kueche_Intro")
RunTree("32_Grotto_Kueche_Intro")
//RunTree("32_Grotto_Kueche_Zwiebeln_schneiden")
//RunTree("32_Grotto_Kueche_alles_gefunden")
//RunTree("32_Grotto_Kueche_Interesse_Kochen")
@ -431,8 +431,6 @@ Tree("32_Grotto_Story_B_Grotto_Antwort_Nonna_Kueche") {
}
}
// fuer Vorzeigeversion
RunTree("32_Grotto_Hide")
RunTree("32_Grotto_Kueche_Intro")
}
}
@ -502,9 +500,6 @@ Tree("32_Grotto_Story_B_Grotto_Antwort_Nonna_Grotto") {
}
}
// fuer Vorzeigeversion
RunTree("32_Grotto_Hide")
BTC.SynthesizeText("Mentre aspetti, se vuoi puoi dare un'occhiata alle foto che ho scattato di recente in Bregaglia. Puoi usare il visore che trovi sul tavolo.")
BTC.SpeechOutputEnded()
@ -658,13 +653,7 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
BTC.Run("AudioSource.AUDIO.Kueche1Zwiebelnsch")
// Zwiebeln schneiden
BTC.Set("Collider.INTERACTABLES.ZwiebelTrigger", "otherTag", "Messer")
BTC.Run("Collider.INTERACTABLES.ZwiebelTrigger")
Composite(Marathon) {
BTC.Run("StudioEventEmitter.INTERACTABLES.ZwiebelSchneiden")
BTC.Hide("GO.INTERACTABLES.Zwiebel01")
BTC.Show("GO.INTERACTABLES.GeschnitteneZwiebe")
}
BTC.FindObjectsByTag("SlicedZwiebel", 6)
BTC.Run("AudioSource.AUDIO.Kueche2Zwiebelnsch")
@ -880,9 +869,9 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
BTC.SynthesizeText("Bene, hai trovato tutto. Ora versa un po' di olio d'oliva nella pentola.")
BTC.SpeechOutputEnded()
// Oel in Topf geben - ToDo: Particle Trigger
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Olivenoel")
BTC.Run("Collider.INTERACTABLES.Topf")
// Oel in Topf geben
BTC.Run("Particle.INTERACTABLES.Olivenoel")
BTC.Run("AudioSource.AUDIO.Kueche2allesgefund")
// Herd anstellen - ToDo: Handling in Story?
@ -890,7 +879,7 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
//BTC.Run("StudioEventEmitter.STATIC.HerdplatteAnstelle")
// Zwiebeln in Topf geben
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Zwiebeln")
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "SlicedZwiebel")
BTC.Run("Collider.INTERACTABLES.Topf")
BTC.Run("StudioEventEmitter.INTERACTABLES.ZwiebelnInTopf")

View File

@ -525,6 +525,24 @@ public class BTC : MonoBehaviour {
}
}
}
[Task]
public void FindObjectsByTag(string tag, int minNumObjs)
{
if ((Task.getState == NodeState.FirstRun) || (Task.getState == NodeState.Running))
{
GameObject[] objsWithTag;
objsWithTag = GameObject.FindGameObjectsWithTag(tag);
if (objsWithTag.Length >= minNumObjs)
{
Debug.Log($"FindObjectsByTag found {objsWithTag.Length} objects with tag {tag}");
Task.SetSucceeded();
return;
}
}
}
#endregion
#region camera or player tracking

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

View File

@ -11,7 +11,7 @@ public class OnCollideSound : MonoBehaviour
{
#if FMOD_AVAILABLE
[SerializeField]
EventReference soundRef;
public EventReference soundRef;
[SerializeField]
float minVelocity = 0.1f;
@ -25,7 +25,7 @@ public class OnCollideSound : MonoBehaviour
private bool _specialCase = false;
private Rigidbody _rigidbody;
private void Start()
private void Awake()
{
_rigidbody = GetComponent<Rigidbody>();
}

View File

@ -12,7 +12,7 @@ public class OnGrabSound : MonoBehaviour
{
#if FMOD_AVAILABLE
[SerializeField]
EventReference soundRef;
public EventReference soundRef;
// Start is called before the first frame update
void Start()

View File

@ -4,6 +4,11 @@ using UnityEngine;
using EzySlice;
using UnityEngine.InputSystem;
using UnityEngine.XR.Interaction.Toolkit;
using System;
#if FMOD_AVAILABLE
using FMOD;
using FMODUnity;
#endif
public class SliceObjectsVR : MonoBehaviour
{
@ -17,6 +22,17 @@ public class SliceObjectsVR : MonoBehaviour
private Vector3 lastSlicerPosition; // Letzte Position von SLICER
private Vector3 slicerVelocity; // Berechnete Geschwindigkeit von SLICER
#if FMOD_AVAILABLE
[SerializeField]
EventReference onGrabSoundRef;
[SerializeField]
EventReference onCollideSoundRef;
[SerializeField]
EventReference sliceSoundRef;
#endif
void Start()
{
lastSlicerPosition = transform.position; // Startposition speichern
@ -28,10 +44,7 @@ public class SliceObjectsVR : MonoBehaviour
slicerVelocity = (transform.position - lastSlicerPosition) / Time.fixedDeltaTime;
lastSlicerPosition = transform.position;
// Debugging: Prüfen, ob die Velocity sinnvoll ist
//Debug.Log($"SLICER Velocity: {slicerVelocity}, Magnitude: {slicerVelocity.magnitude}");
// Prüfen, ob ein schneidbares Objekt getroffen wird
// Pruefen, ob ein schneidbares Objekt getroffen wird
bool hasHit = Physics.Linecast(startSlicePoint.position, endSlicePoint.position, out RaycastHit hit, sliceableLayer);
if (hasHit)
{
@ -42,22 +55,21 @@ public class SliceObjectsVR : MonoBehaviour
public void Slice(GameObject target)
{
//Debug.Log("Slice Function active: " + target.name);
// Normalenvektor für die Schnittebene berechnen
// Normalenvektor fuer die Schnittebene berechnen
Vector3 planeNormal = Vector3.Cross(endSlicePoint.position - startSlicePoint.position, slicerVelocity);
planeNormal.Normalize();
//Debug.Log($"Direction: {planeNormal}, Magnitude: {planeNormal.magnitude}");
//Debug.Log($"Velocity: {slicerVelocity}, Magnitude: {slicerVelocity.magnitude}");
// Prüfen, ob das Objekt geschnitten werden kann
// Pruefen, ob das Objekt geschnitten werden kann
SlicedHull hull = target.Slice(endSlicePoint.position, planeNormal);
if (hull != null)
{
//Debug.Log("Hull isn't empty");
#if FMOD_AVAILABLE
RuntimeManager.PlayOneShot(sliceSoundRef, transform.position);
#endif
GameObject upperHull = hull.CreateUpperHull(target, crossSectionMaterial);
SetupSlicedComponent(upperHull);
@ -70,15 +82,29 @@ public class SliceObjectsVR : MonoBehaviour
public void SetupSlicedComponent(GameObject slicedObject)
{
//Debug.Log("New object created");
Rigidbody rb = slicedObject.AddComponent<Rigidbody>(); //add Rigidbody
rb.interpolation = RigidbodyInterpolation.Interpolate;
MeshCollider collider = slicedObject.AddComponent<MeshCollider>(); //add Meshcolider
collider.convex = true; //make Collider convex
rb.AddExplosionForce(cutForce, slicedObject.transform.position, explosionRadius); //add force for realistic behaviour
slicedObject.layer = 6; // 6 = "sliceableLayer"
slicedObject.AddComponent<XRGrabInteractable>(); //add grabbable Script
slicedObject.AddComponent<ComponentController>(); //add BT-Controller
slicedObject.AddComponent<OnGrabSound>(); //add grab sound
slicedObject.AddComponent<OnCollideSound>(); //add collision sound
XRGrabInteractable grabInteractable = slicedObject.AddComponent<XRGrabInteractable>(); //add grabbable Script
grabInteractable.movementType = XRBaseInteractable.MovementType.VelocityTracking;
grabInteractable.useDynamicAttach = true;
#if FMOD_AVAILABLE
OnGrabSound onGrabSoundScript = slicedObject.AddComponent<OnGrabSound>(); //add grab sound
onGrabSoundScript.soundRef = onGrabSoundRef;
OnCollideSound onCollideSoundScript = slicedObject.AddComponent<OnCollideSound>(); //add collision sound
onCollideSoundScript.soundRef = onCollideSoundRef;
#endif
slicedObject.gameObject.tag = "SlicedZwiebel";
string timeStamp = DateTime.Now.ToString("mmssffff");
slicedObject.gameObject.name = $"SlicedZwiebel_{timeStamp}";
}
}

View File

@ -18,6 +18,7 @@ TagManager:
- Parmigiano
- Topf
- Messer
- SlicedZwiebel
layers:
- Default
- TransparentFX