added TwigInteraction

This commit is contained in:
AgentSchmisch 2025-06-18 09:36:09 +02:00
parent ae0137770d
commit eb79eb37ae
5 changed files with 108 additions and 0 deletions

View File

@ -9,6 +9,8 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 2194414921720918247} - component: {fileID: 2194414921720918247}
- component: {fileID: 3644914065091979672}
- component: {fileID: 5566268700457196979}
m_Layer: 0 m_Layer: 0
m_Name: Stick m_Name: Stick
m_TagString: Untagged m_TagString: Untagged
@ -32,6 +34,40 @@ Transform:
- {fileID: 2814733181455701747} - {fileID: 2814733181455701747}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3644914065091979672
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1735147224235397921}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fa69353f905bb684391c0b7eabce561f, type: 3}
m_Name:
m_EditorClassIdentifier:
twigReward: {fileID: 11400000, guid: dc78e90d3a39cf54fbaf1cf84bf17059, type: 2}
--- !u!65 &5566268700457196979
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1735147224235397921}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 1
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 0.8, y: 0.6, z: 2.07}
m_Center: {x: 0, y: 0, z: -0.37}
--- !u!1001 &2343360094618611992 --- !u!1001 &2343360094618611992
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -0,0 +1,46 @@
using System;
using Unity.Mathematics;
using UnityEngine;
using Random = UnityEngine.Random;
using AK.Wwise; // Make sure your Wwise namespace is correct
public class TwigInteraction : MonoBehaviour
{
private bool collected = false;
[SerializeField] private ItemReward twigReward;
// Wwise Events
// public AK.Wwise.Event PlayBushesEvent;
// public AK.Wwise.Event PlayBerryWithBushEvent;
void Start()
{
}
void OnTriggerEnter(Collider other)
{
if (!collected)
{
// Play the "Play_BerryWithBush" event if bush has berries
// PlayBerryWithBushEvent.Post(gameObject);
other.gameObject.GetComponent<PlayerInteraction>().AddToInventory(twigReward);
Destroy(gameObject);
collected = true;
}
}
public void SetCollected(bool picked)
{
collected = picked;
}
public bool IsCollected()
{
return collected;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fa69353f905bb684391c0b7eabce561f

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 0}
m_Name: TwigReward
m_EditorClassIdentifier: Assembly-CSharp::ItemReward
itemName: Twig
quantity: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dc78e90d3a39cf54fbaf1cf84bf17059
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant: