This commit is contained in:
2025-09-09 13:46:49 +02:00
4 changed files with 58 additions and 0 deletions

View File

@@ -434448,6 +434448,18 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
stepData: {fileID: 11400000, guid: 8ac614a698631554ab8ac39aed04a189, type: 2} stepData: {fileID: 11400000, guid: 8ac614a698631554ab8ac39aed04a189, type: 2}
--- !u!114 &1182494941
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1182494929}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 833a4ccef651449e973e623d9107bef5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1192177492 --- !u!1001 &1192177492
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -441481,6 +441493,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 7379304988657006554, guid: c36b48a324dcaef4cb5ee0f8ca57f0d6, type: 3} - targetCorrespondingSourceObject: {fileID: 7379304988657006554, guid: c36b48a324dcaef4cb5ee0f8ca57f0d6, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 1182494937} addedObject: {fileID: 1182494937}
- targetCorrespondingSourceObject: {fileID: 7379304988657006554, guid: c36b48a324dcaef4cb5ee0f8ca57f0d6, type: 3}
insertIndex: -1
addedObject: {fileID: 1182494941}
m_SourcePrefab: {fileID: 100100000, guid: c36b48a324dcaef4cb5ee0f8ca57f0d6, type: 3} m_SourcePrefab: {fileID: 100100000, guid: c36b48a324dcaef4cb5ee0f8ca57f0d6, type: 3}
--- !u!1001 &7535757761066548300 --- !u!1001 &7535757761066548300
PrefabInstance: PrefabInstance:

View File

@@ -68,4 +68,9 @@ public class Interactable : MonoBehaviour, ITouchInputConsumer
} }
return anySuccess; return anySuccess;
} }
public void CompleteInteraction(bool success)
{
InteractionComplete?.Invoke(success);
}
} }

View File

@@ -0,0 +1,35 @@
using UnityEngine;
using System;
/// <summary>
/// MonoBehaviour that immediately completes an interaction when started.
/// </summary>
public class OneClickInteraction : MonoBehaviour
{
private Interactable interactable;
void Awake()
{
interactable = GetComponent<Interactable>();
if (interactable != null)
{
interactable.StartedInteraction += OnStartedInteraction;
}
}
void OnDestroy()
{
if (interactable != null)
{
interactable.StartedInteraction -= OnStartedInteraction;
}
}
private void OnStartedInteraction()
{
if (interactable != null)
{
interactable.CompleteInteraction(true);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 833a4ccef651449e973e623d9107bef5
timeCreated: 1757417586