Simple interactable rework

This commit is contained in:
Michal Pikulski
2025-10-31 13:50:08 +01:00
parent 095f21908b
commit 917230e10a
15 changed files with 1897 additions and 103 deletions

View File

@@ -8,7 +8,7 @@ namespace Editor
public class ItemPrefabEditorWindow : EditorWindow
{
private GameObject _selectedGameObject;
private Interactable _interactable;
private InteractableBase _interactable;
private PickupItemData _pickupData;
private PuzzleStepSO _objectiveData;
private UnityEditor.Editor _soEditor;
@@ -42,17 +42,17 @@ namespace Editor
if (Selection.activeGameObject != null)
{
_selectedGameObject = Selection.activeGameObject;
_interactable = _selectedGameObject.GetComponent<Interactable>();
_interactable = _selectedGameObject.GetComponent<InteractableBase>();
}
else if (Selection.activeObject is GameObject go)
{
_selectedGameObject = go;
_interactable = go.GetComponent<Interactable>();
_interactable = go.GetComponent<InteractableBase>();
}
if (_selectedGameObject == null || _interactable == null)
{
EditorGUILayout.HelpBox("Select a GameObject or prefab with an Interactable component to edit.", MessageType.Info);
EditorGUILayout.HelpBox("Select a GameObject or prefab with an InteractableBase component to edit.", MessageType.Info);
return;
}

View File

@@ -1,4 +1,4 @@
using UnityEditor;
using UnityEditor;
using UnityEngine;
using System.IO;
using Interactions;
@@ -124,7 +124,7 @@ namespace Editor
private void CreatePrefab()
{
var go = new GameObject(_prefabName);
go.AddComponent<Interactable>();
// Note: No need to add InteractableBase separately - Pickup and ItemSlot inherit from it
go.AddComponent<BoxCollider>();
int interactableLayer = LayerMask.NameToLayer("Interactable");
if (interactableLayer != -1)