Rework interactables into a flatter hierarchy, reenable puzzles as well

This commit is contained in:
Michal Pikulski
2025-09-11 13:00:26 +02:00
parent 3a40d1a151
commit e1ff13db30
32 changed files with 981 additions and 1018 deletions

View File

@@ -1,4 +1,6 @@
using UnityEditor;
using Interactions;
using PuzzleS;
using UnityEditor;
using UnityEngine;
namespace Editor
@@ -64,27 +66,16 @@ namespace Editor
{
PrefabEditorUtility.RemoveComponent<Pickup>(_selectedGameObject);
}
// CombineWithBehavior
bool hasCombine = _selectedGameObject.GetComponent<CombineWithBehavior>() != null;
bool addCombine = EditorGUILayout.Toggle("CombineWithBehavior", hasCombine);
if (addCombine && !hasCombine)
{
PrefabEditorUtility.AddOrGetComponent<CombineWithBehavior>(_selectedGameObject);
}
else if (!addCombine && hasCombine)
{
PrefabEditorUtility.RemoveComponent<CombineWithBehavior>(_selectedGameObject);
}
// SlotItemBehavior
bool hasSlot = _selectedGameObject.GetComponent<SlotItemBehavior>() != null;
bool hasSlot = _selectedGameObject.GetComponent<ItemSlot>() != null;
bool addSlot = EditorGUILayout.Toggle("SlotItemBehavior", hasSlot);
if (addSlot && !hasSlot)
{
PrefabEditorUtility.AddOrGetComponent<SlotItemBehavior>(_selectedGameObject);
PrefabEditorUtility.AddOrGetComponent<ItemSlot>(_selectedGameObject);
}
else if (!addSlot && hasSlot)
{
PrefabEditorUtility.RemoveComponent<SlotItemBehavior>(_selectedGameObject);
PrefabEditorUtility.RemoveComponent<ItemSlot>(_selectedGameObject);
}
// ObjectiveStepBehaviour
bool hasObjective = _selectedGameObject.GetComponent<ObjectiveStepBehaviour>() != null;