Interactables Added

This commit is contained in:
Syntriax 2022-02-22 21:00:40 +03:00
parent aa05954353
commit dd543351c0
9 changed files with 959 additions and 203 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 15ad75cf57fa64a4f9d63b84cad20918
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
namespace Interactable
{
public interface IInteractable
{
void Interact();
void ResetInteraction();
}
}

View File

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

View File

@ -0,0 +1,29 @@
using UnityEngine;
namespace Interactable
{
public abstract class InteractableBase : MonoBehaviour, IInteractable
{
protected bool hasBeenInteracted = false;
public void Interact()
{
if (hasBeenInteracted)
return;
OnInteract();
hasBeenInteracted = true;
}
public void ResetInteraction()
{
if (!hasBeenInteracted)
return;
OnResetInteraction();
hasBeenInteracted = false;
}
protected abstract void OnInteract();
protected abstract void OnResetInteraction();
}
}

View File

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

View File

@ -0,0 +1,14 @@
using UnityEngine;
using UnityEngine.Events;
namespace Interactable
{
public class UnityEventInteractable : InteractableBase
{
[SerializeField] protected UnityEvent onInteractEvent = new UnityEvent();
[SerializeField] protected UnityEvent onResetInteractionEvent = new UnityEvent();
protected override void OnInteract() => onInteractEvent?.Invoke();
protected override void OnResetInteraction() => onResetInteractionEvent?.Invoke();
}
}

View File

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

View File

@ -6,14 +6,14 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedSceneGuid-0:
value: 06550c57540350025c0b0f2747220a44174f4b73297070642b714465b0e6366e
flags: 0
RecentlyUsedSceneGuid-1:
value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661
flags: 0
RecentlyUsedSceneGuid-2:
RecentlyUsedSceneGuid-1:
value: 5002060403010b5f0f560e7a47260a444f4f1e2e2f2e27312f7f4536e0b6633d
flags: 0
RecentlyUsedSceneGuid-2:
value: 06550c57540350025c0b0f2747220a44174f4b73297070642b714465b0e6366e
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0