Made Changes To slotted items (not fully functional but progressing)

Added Unity events to the Slotting Items, the eyes react fine but sometimes they fuck up. gonna check that out later.
This commit is contained in:
2025-09-11 17:03:56 +02:00
parent 15b8146815
commit 9b590ca6ec
15 changed files with 455 additions and 409 deletions

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
namespace Interactions
{
@@ -9,6 +10,11 @@ namespace Interactions
[RequireComponent(typeof(Interactable))]
public class ItemSlot : Pickup
{
public UnityEvent onItemSlotted;
public UnityEvent onItemSlotRemoved;
public UnityEvent onCorrectItemSlotted;
public UnityEvent onIncorrectItemSlotted;
public UnityEvent onForbiddenItemSlotted;
private PickupItemData _currentlySlottedItemData;
public SpriteRenderer slottedItemRenderer;
private GameObject _currentlySlottedItemObject = null;
@@ -44,6 +50,7 @@ namespace Interactions
FollowerController.TryPickupItem(_currentlySlottedItemObject, _currentlySlottedItemData);
_currentlySlottedItemObject = null;
_currentlySlottedItemData = null;
onItemSlotRemoved?.Invoke();
UpdateSlottedSprite();
return;
}
@@ -72,6 +79,7 @@ namespace Interactions
if (forbidden.Contains(heldItemData))
{
DebugUIMessage.Show("Can't place that here.");
onForbiddenItemSlotted?.Invoke();
Interactable.BroadcastInteractionComplete(false);
return;
}
@@ -79,12 +87,14 @@ namespace Interactions
SlotItem(heldItemObj, heldItemData);
if (allowed.Contains(heldItemData))
{
onCorrectItemSlotted?.Invoke();
Interactable.BroadcastInteractionComplete(true);
return;
}
else
{
DebugUIMessage.Show("I'm not sure this works.");
onIncorrectItemSlotted?.Invoke();
Interactable.BroadcastInteractionComplete(false);
return;
}