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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user