Rework interactables into a flatter hierarchy, reenable puzzles as well
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
using Interactions;
|
||||
using PuzzleS;
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
@@ -121,13 +123,9 @@ namespace Editor
|
||||
var pickup = go.AddComponent<Pickup>();
|
||||
pickup.itemData = _pickupData;
|
||||
}
|
||||
if (_addCombineWith)
|
||||
{
|
||||
go.AddComponent<CombineWithBehavior>();
|
||||
}
|
||||
if (_addSlot)
|
||||
{
|
||||
go.AddComponent<SlotItemBehavior>();
|
||||
go.AddComponent<ItemSlot>();
|
||||
}
|
||||
if (_addObjective)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,8 @@ using UnityEngine;
|
||||
using UnityEditor.SceneManagement;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Interactions;
|
||||
using PuzzleS;
|
||||
|
||||
public class SceneObjectLocatorWindow : EditorWindow
|
||||
{
|
||||
@@ -43,12 +45,10 @@ public class SceneObjectLocatorWindow : EditorWindow
|
||||
foreach (var pickup in pickups)
|
||||
{
|
||||
var go = pickup.gameObject;
|
||||
bool hasCombine = go.GetComponent<CombineWithBehavior>() != null;
|
||||
bool hasSlot = go.GetComponent<SlotItemBehavior>() != null;
|
||||
bool hasSlot = go.GetComponent<ItemSlot>() != null;
|
||||
pickupInfos.Add(new PickupInfo
|
||||
{
|
||||
pickup = pickup,
|
||||
hasCombine = hasCombine,
|
||||
hasSlot = hasSlot
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user