diff --git a/Assets/Prefab/Gameplay/BaseCube.prefab b/Assets/Prefab/Gameplay/BaseCube.prefab index 152c26d..b57d53f 100644 --- a/Assets/Prefab/Gameplay/BaseCube.prefab +++ b/Assets/Prefab/Gameplay/BaseCube.prefab @@ -13,7 +13,6 @@ GameObject: - component: {fileID: 3694179230033504797} - component: {fileID: 470645613676258024} - component: {fileID: 8187785643586722023} - - component: {fileID: 7940149935342460565} - component: {fileID: 5829756071943867929} - component: {fileID: 3049630257319171134} m_Layer: 0 @@ -136,18 +135,6 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &7940149935342460565 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7739979277884825363} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7986c88b8e1d4944832af56e23188597, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &5829756071943867929 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefab/Gameplay/BaseSphere.prefab b/Assets/Prefab/Gameplay/BaseSphere.prefab index 4f8c9b9..889b5e3 100644 --- a/Assets/Prefab/Gameplay/BaseSphere.prefab +++ b/Assets/Prefab/Gameplay/BaseSphere.prefab @@ -13,7 +13,6 @@ GameObject: - component: {fileID: 242555714111735108} - component: {fileID: 4435893386940746007} - component: {fileID: 2552293626926492943} - - component: {fileID: 3427371979469557628} - component: {fileID: 1157280543463811332} - component: {fileID: 9140300362975493256} m_Layer: 0 @@ -136,18 +135,6 @@ SphereCollider: serializedVersion: 3 m_Radius: 0.5 m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &3427371979469557628 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7979385610396712053} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7986c88b8e1d4944832af56e23188597, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &1157280543463811332 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefab/Gameplay/Button.prefab b/Assets/Prefab/Gameplay/Button.prefab index c48471c..4ffec2a 100644 --- a/Assets/Prefab/Gameplay/Button.prefab +++ b/Assets/Prefab/Gameplay/Button.prefab @@ -12,7 +12,6 @@ GameObject: - component: {fileID: 8222817459474332972} - component: {fileID: 8915067524543900667} - component: {fileID: 2933073816800901446} - - component: {fileID: 2654927572387158689} - component: {fileID: 162156210837205425} - component: {fileID: 4434834246038522293} m_Layer: 0 @@ -108,18 +107,6 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &2654927572387158689 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2052340463965227198} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7986c88b8e1d4944832af56e23188597, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &162156210837205425 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefab/Gameplay/Door.prefab b/Assets/Prefab/Gameplay/Door.prefab index 0f2a7ae..2e3642c 100644 --- a/Assets/Prefab/Gameplay/Door.prefab +++ b/Assets/Prefab/Gameplay/Door.prefab @@ -12,7 +12,6 @@ GameObject: - component: {fileID: 1966939443082034528} - component: {fileID: 1791426126632920350} - component: {fileID: 6559594074799131378} - - component: {fileID: 2740601845815088892} - component: {fileID: 605469399670797709} - component: {fileID: 6634784627554641663} m_Layer: 0 @@ -108,18 +107,6 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &2740601845815088892 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2729643726423589850} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7986c88b8e1d4944832af56e23188597, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &605469399670797709 MonoBehaviour: m_ObjectHideFlags: 0 @@ -133,7 +120,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Interactable: 1 - isActive: 1 --- !u!114 &6634784627554641663 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefab/Gameplay/Emitter.prefab b/Assets/Prefab/Gameplay/Emitter.prefab index 5a77ddd..0063478 100644 --- a/Assets/Prefab/Gameplay/Emitter.prefab +++ b/Assets/Prefab/Gameplay/Emitter.prefab @@ -43,7 +43,6 @@ GameObject: - component: {fileID: 7587903706495042174} - component: {fileID: 9191155306757799119} - component: {fileID: 8846970934275178021} - - component: {fileID: 1219148107627415208} - component: {fileID: 8496958603087533895} - component: {fileID: 7351527485767933101} m_Layer: 0 @@ -140,18 +139,6 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &1219148107627415208 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5873928673589519195} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7986c88b8e1d4944832af56e23188597, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &8496958603087533895 MonoBehaviour: m_ObjectHideFlags: 0 @@ -183,3 +170,4 @@ MonoBehaviour: emitDirection: {x: 0, y: 0, z: 1} emitForce: 10 emitInterval: 1 + destroyDelay: 5 diff --git a/Assets/Prefab/Gameplay/Lever.prefab b/Assets/Prefab/Gameplay/Lever.prefab index d8002f3..f781c95 100644 --- a/Assets/Prefab/Gameplay/Lever.prefab +++ b/Assets/Prefab/Gameplay/Lever.prefab @@ -12,7 +12,6 @@ GameObject: - component: {fileID: 4763900636075465414} - component: {fileID: 6839980979269427984} - component: {fileID: 6900514999789347776} - - component: {fileID: 5480938290288266788} - component: {fileID: 3969518804808817043} - component: {fileID: 4936355834716623489} m_Layer: 0 @@ -108,18 +107,6 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &5480938290288266788 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6227019518059310355} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7986c88b8e1d4944832af56e23188597, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &3969518804808817043 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefab/Gameplay/Manager/EditableManager.prefab b/Assets/Prefab/Gameplay/Manager/EditableManager.prefab new file mode 100644 index 0000000..aa7ef4a --- /dev/null +++ b/Assets/Prefab/Gameplay/Manager/EditableManager.prefab @@ -0,0 +1,46 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &5733440185495106210 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1741528481904243288} + - component: {fileID: 2771123290872083115} + m_Layer: 0 + m_Name: EditableManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1741528481904243288 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5733440185495106210} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1341.3049, y: 771.7224, z: 0.19054106} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2771123290872083115 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5733440185495106210} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9704373d6ec1409bb4e26e4b16324c40, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Prefab/Gameplay/Manager/EditableManager.prefab.meta b/Assets/Prefab/Gameplay/Manager/EditableManager.prefab.meta new file mode 100644 index 0000000..da21728 --- /dev/null +++ b/Assets/Prefab/Gameplay/Manager/EditableManager.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 580e72e098ea0074795102df8d1f812e +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/Gameplay/NumberSlot.prefab b/Assets/Prefab/Gameplay/NumberSlot.prefab index 5a8d422..3312e4c 100644 --- a/Assets/Prefab/Gameplay/NumberSlot.prefab +++ b/Assets/Prefab/Gameplay/NumberSlot.prefab @@ -12,7 +12,6 @@ GameObject: - component: {fileID: 1875558020952416763} - component: {fileID: 6958443043046651409} - component: {fileID: 3036000835194628394} - - component: {fileID: 9057593411103083886} - component: {fileID: 7384438008133576482} - component: {fileID: 2187320556207737093} m_Layer: 0 @@ -108,18 +107,6 @@ BoxCollider: serializedVersion: 3 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &9057593411103083886 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1079693037897703353} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7986c88b8e1d4944832af56e23188597, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &7384438008133576482 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefab/Gameplay/PressurePlate.prefab b/Assets/Prefab/Gameplay/PressurePlate.prefab index b184cbc..b7d1434 100644 --- a/Assets/Prefab/Gameplay/PressurePlate.prefab +++ b/Assets/Prefab/Gameplay/PressurePlate.prefab @@ -14,7 +14,6 @@ GameObject: - component: {fileID: 8785614081330407045} - component: {fileID: 220912239936987690} - component: {fileID: -7803032184951374842} - - component: {fileID: 4542395966412092557} m_Layer: 0 m_Name: PressurePlate m_TagString: Untagged @@ -139,15 +138,3 @@ MonoBehaviour: m_Bits: 4294967295 plateSize: {x: 1.2, y: 0.4, z: 1.2} plateOffset: {x: 0, y: 0.5, z: 0} ---- !u!114 &4542395966412092557 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2191333364839819432} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7986c88b8e1d4944832af56e23188597, type: 3} - m_Name: - m_EditorClassIdentifier: diff --git a/Assets/Scenes/Level1.unity b/Assets/Scenes/Level1.unity index f79f6e5..57f8830 100644 --- a/Assets/Scenes/Level1.unity +++ b/Assets/Scenes/Level1.unity @@ -1559,6 +1559,74 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b3e24e2df98d14e4ebc08cc68c071afa, type: 3} +--- !u!1001 &2706680471642920534 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalPosition.x + value: 1341.3049 + objectReference: {fileID: 0} + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalPosition.y + value: 771.7224 + objectReference: {fileID: 0} + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalPosition.z + value: 0.19054106 + objectReference: {fileID: 0} + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5733440185495106210, guid: 580e72e098ea0074795102df8d1f812e, + type: 3} + propertyPath: m_Name + value: EditableManager + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 580e72e098ea0074795102df8d1f812e, type: 3} --- !u!1001 &7020889523296792185 PrefabInstance: m_ObjectHideFlags: 0 @@ -1704,6 +1772,7 @@ SceneRoots: - {fileID: 1279118200} - {fileID: 769057572} - {fileID: 7233731901126413131} + - {fileID: 2706680471642920534} - {fileID: 410087041} - {fileID: 1274249804} - {fileID: 7020889523296792185} diff --git a/Assets/Script/Gameplay/Facility.meta b/Assets/Script/Gameplay/Edit.meta similarity index 100% rename from Assets/Script/Gameplay/Facility.meta rename to Assets/Script/Gameplay/Edit.meta diff --git a/Assets/Script/Gameplay/Facility/ButtonInteractController.cs b/Assets/Script/Gameplay/Edit/ButtonInteractController.cs similarity index 98% rename from Assets/Script/Gameplay/Facility/ButtonInteractController.cs rename to Assets/Script/Gameplay/Edit/ButtonInteractController.cs index c442692..766eb6a 100644 --- a/Assets/Script/Gameplay/Facility/ButtonInteractController.cs +++ b/Assets/Script/Gameplay/Edit/ButtonInteractController.cs @@ -4,7 +4,7 @@ using UnityEngine; using Script.Gameplay.Interface; using Script.Gameplay.Connect; -namespace Script.Gameplay.Facility +namespace Script.Gameplay.Edit { public class ButtonInteractController : MonoBehaviour, IInteractable, IEditableComponent, IConnectable, ISignalSender { diff --git a/Assets/Script/Gameplay/Facility/ButtonInteractController.cs.meta b/Assets/Script/Gameplay/Edit/ButtonInteractController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/ButtonInteractController.cs.meta rename to Assets/Script/Gameplay/Edit/ButtonInteractController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/ColliderEditableController.cs b/Assets/Script/Gameplay/Edit/ColliderEditableController.cs similarity index 97% rename from Assets/Script/Gameplay/Facility/ColliderEditableController.cs rename to Assets/Script/Gameplay/Edit/ColliderEditableController.cs index 7e14ac1..5e7fd1f 100644 --- a/Assets/Script/Gameplay/Facility/ColliderEditableController.cs +++ b/Assets/Script/Gameplay/Edit/ColliderEditableController.cs @@ -1,7 +1,7 @@ using UnityEngine; using Script.Gameplay.Interface; -namespace Script.Gameplay.Facility +namespace Script.Gameplay.Edit { [RequireComponent(typeof(Collider))] public class ColliderEditableController : MonoBehaviour, IEditableComponent diff --git a/Assets/Script/Gameplay/Facility/ColliderEditableController.cs.meta b/Assets/Script/Gameplay/Edit/ColliderEditableController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/ColliderEditableController.cs.meta rename to Assets/Script/Gameplay/Edit/ColliderEditableController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/DoorInteractController.cs b/Assets/Script/Gameplay/Edit/DoorInteractController.cs similarity index 98% rename from Assets/Script/Gameplay/Facility/DoorInteractController.cs rename to Assets/Script/Gameplay/Edit/DoorInteractController.cs index f105438..0f81ae0 100644 --- a/Assets/Script/Gameplay/Facility/DoorInteractController.cs +++ b/Assets/Script/Gameplay/Edit/DoorInteractController.cs @@ -5,7 +5,7 @@ using UnityEngine; using Script.Gameplay.Interface; using Script.Gameplay.Connect; -namespace Script.Gameplay.Facility +namespace Script.Gameplay.Edit { public class DoorInteractController : MonoBehaviour, IInteractable, IEditableComponent, IConnectable { diff --git a/Assets/Script/Gameplay/Facility/DoorInteractController.cs.meta b/Assets/Script/Gameplay/Edit/DoorInteractController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/DoorInteractController.cs.meta rename to Assets/Script/Gameplay/Edit/DoorInteractController.cs.meta diff --git a/Assets/Script/Gameplay/Edit/EditableManager.cs b/Assets/Script/Gameplay/Edit/EditableManager.cs new file mode 100644 index 0000000..452a433 --- /dev/null +++ b/Assets/Script/Gameplay/Edit/EditableManager.cs @@ -0,0 +1,23 @@ +using Core; +using UnityEngine; +using System.Collections.Generic; +using Script.Gameplay.Interface; + +namespace Script.Gameplay.Edit +{ + public class EditableManager : MonoSingleton + { + public static List GetEditableComponents(GameObject target) + { + var components = new List(); + foreach (var mb in target.GetComponentsInChildren(true)) + { + if (mb is IEditableComponent editableComponent) + { + components.Add(editableComponent); + } + } + return components; + } + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/EditableManager.cs.meta b/Assets/Script/Gameplay/Edit/EditableManager.cs.meta new file mode 100644 index 0000000..eb6ba4a --- /dev/null +++ b/Assets/Script/Gameplay/Edit/EditableManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9704373d6ec1409bb4e26e4b16324c40 +timeCreated: 1761035435 \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/EmitterController.cs b/Assets/Script/Gameplay/Edit/EmitterController.cs similarity index 98% rename from Assets/Script/Gameplay/Facility/EmitterController.cs rename to Assets/Script/Gameplay/Edit/EmitterController.cs index 08b8188..8f81e7b 100644 --- a/Assets/Script/Gameplay/Facility/EmitterController.cs +++ b/Assets/Script/Gameplay/Edit/EmitterController.cs @@ -4,7 +4,7 @@ using UnityEngine; using Script.Gameplay.Connect; using Script.Gameplay.Interface; -namespace Script.Gameplay.Facility +namespace Script.Gameplay.Edit { public class EmitterController : MonoBehaviour, IEditableComponent, IConnectable { diff --git a/Assets/Script/Gameplay/Facility/EmitterController.cs.meta b/Assets/Script/Gameplay/Edit/EmitterController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/EmitterController.cs.meta rename to Assets/Script/Gameplay/Edit/EmitterController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/InteractableBaseController.cs b/Assets/Script/Gameplay/Edit/InteractableBaseController.cs similarity index 95% rename from Assets/Script/Gameplay/Facility/InteractableBaseController.cs rename to Assets/Script/Gameplay/Edit/InteractableBaseController.cs index 2d003f0..191f34b 100644 --- a/Assets/Script/Gameplay/Facility/InteractableBaseController.cs +++ b/Assets/Script/Gameplay/Edit/InteractableBaseController.cs @@ -1,7 +1,7 @@ using UnityEngine; using Script.Gameplay.Interface; -namespace Script.Gameplay.Facility +namespace Script.Gameplay.Edit { public abstract class InteractableBaseController : MonoBehaviour, IInteractable { diff --git a/Assets/Script/Gameplay/Facility/InteractableBaseController.cs.meta b/Assets/Script/Gameplay/Edit/InteractableBaseController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/InteractableBaseController.cs.meta rename to Assets/Script/Gameplay/Edit/InteractableBaseController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/LeverInteractController.cs b/Assets/Script/Gameplay/Edit/LeverInteractController.cs similarity index 98% rename from Assets/Script/Gameplay/Facility/LeverInteractController.cs rename to Assets/Script/Gameplay/Edit/LeverInteractController.cs index d9fe86c..545b21e 100644 --- a/Assets/Script/Gameplay/Facility/LeverInteractController.cs +++ b/Assets/Script/Gameplay/Edit/LeverInteractController.cs @@ -3,7 +3,7 @@ using UnityEngine; using Script.Gameplay.Interface; using Script.Gameplay.Connect; -namespace Script.Gameplay.Facility +namespace Script.Gameplay.Edit { public class LeverInteractController : MonoBehaviour, IInteractable, IEditableComponent, IConnectable, ISignalSender { diff --git a/Assets/Script/Gameplay/Facility/LeverInteractController.cs.meta b/Assets/Script/Gameplay/Edit/LeverInteractController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/LeverInteractController.cs.meta rename to Assets/Script/Gameplay/Edit/LeverInteractController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/NumberSlotController.cs b/Assets/Script/Gameplay/Edit/NumberSlotController.cs similarity index 98% rename from Assets/Script/Gameplay/Facility/NumberSlotController.cs rename to Assets/Script/Gameplay/Edit/NumberSlotController.cs index cc9df89..6658ad6 100644 --- a/Assets/Script/Gameplay/Facility/NumberSlotController.cs +++ b/Assets/Script/Gameplay/Edit/NumberSlotController.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; using Script.Gameplay.Connect; -namespace Script.Gameplay.Facility +namespace Script.Gameplay.Edit { // 号码枚举类型 public enum NumberType diff --git a/Assets/Script/Gameplay/Facility/NumberSlotController.cs.meta b/Assets/Script/Gameplay/Edit/NumberSlotController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/NumberSlotController.cs.meta rename to Assets/Script/Gameplay/Edit/NumberSlotController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/PressurePlateController.cs b/Assets/Script/Gameplay/Edit/PressurePlateController.cs similarity index 98% rename from Assets/Script/Gameplay/Facility/PressurePlateController.cs rename to Assets/Script/Gameplay/Edit/PressurePlateController.cs index cd1b457..0818bdf 100644 --- a/Assets/Script/Gameplay/Facility/PressurePlateController.cs +++ b/Assets/Script/Gameplay/Edit/PressurePlateController.cs @@ -3,7 +3,7 @@ using UnityEngine; using Script.Gameplay.Interface; using Script.Gameplay.Connect; -namespace Script.Gameplay.Facility +namespace Script.Gameplay.Edit { public class PressurePlateController : MonoBehaviour, IEditableComponent, IConnectable, ISignalSender { diff --git a/Assets/Script/Gameplay/Facility/PressurePlateController.cs.meta b/Assets/Script/Gameplay/Edit/PressurePlateController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/PressurePlateController.cs.meta rename to Assets/Script/Gameplay/Edit/PressurePlateController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/RigidbodyEditableController.cs b/Assets/Script/Gameplay/Edit/RigidbodyEditableController.cs similarity index 97% rename from Assets/Script/Gameplay/Facility/RigidbodyEditableController.cs rename to Assets/Script/Gameplay/Edit/RigidbodyEditableController.cs index 6346875..396418f 100644 --- a/Assets/Script/Gameplay/Facility/RigidbodyEditableController.cs +++ b/Assets/Script/Gameplay/Edit/RigidbodyEditableController.cs @@ -1,7 +1,7 @@ using UnityEngine; using Script.Gameplay.Interface; -namespace Script.Gameplay.Facility +namespace Script.Gameplay.Edit { [RequireComponent(typeof(Rigidbody))] public class RigidbodyEditableController : MonoBehaviour, IEditableComponent diff --git a/Assets/Script/Gameplay/Facility/RigidbodyEditableController.cs.meta b/Assets/Script/Gameplay/Edit/RigidbodyEditableController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/RigidbodyEditableController.cs.meta rename to Assets/Script/Gameplay/Edit/RigidbodyEditableController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/FacilityEditableController.cs b/Assets/Script/Gameplay/Facility/FacilityEditableController.cs deleted file mode 100644 index bb5b7f2..0000000 --- a/Assets/Script/Gameplay/Facility/FacilityEditableController.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using Script.Gameplay.Player; -using UnityEngine; -using Script.Gameplay.Interface; - -namespace Script.Gameplay.Facility -{ - public class FacilityEditableController : MonoBehaviour, IEditable - { - public void OnGazeEnter(PlayerEditController editor) - { - - } - - public void OnGazeExit(PlayerEditController editor) - { - - } - - public void BeginEdit() - { - - } - - public void EndEdit() - { - - } - - public List GetEditableComponents() - { - var components = new List(); - foreach (var mb in GetComponentsInChildren(true)) - { - if (mb is IEditableComponent editableComponent) - { - components.Add(editableComponent); - } - } - return components; - } - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/FacilityEditableController.cs.meta b/Assets/Script/Gameplay/Facility/FacilityEditableController.cs.meta deleted file mode 100644 index 0ec01f9..0000000 --- a/Assets/Script/Gameplay/Facility/FacilityEditableController.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7986c88b8e1d4944832af56e23188597 -timeCreated: 1760664530 \ No newline at end of file diff --git a/Assets/Script/Gameplay/Interface/IEditable.cs b/Assets/Script/Gameplay/Interface/IEditable.cs index 473846b..768ed48 100644 --- a/Assets/Script/Gameplay/Interface/IEditable.cs +++ b/Assets/Script/Gameplay/Interface/IEditable.cs @@ -1,16 +1,16 @@ using UnityEngine; using Script.Gameplay.Player; using System.Collections.Generic; -using Script.Gameplay.Facility; +// using Script.Gameplay.Facility; namespace Script.Gameplay.Interface { - public interface IEditable - { - void OnGazeEnter(PlayerEditController editor); // 玩家开始注视时触发 - void OnGazeExit(PlayerEditController editor); // 玩家停止注视时触发 - void BeginEdit(); - void EndEdit(); - List GetEditableComponents(); - } + // public interface IEditable + // { + // void OnGazeEnter(PlayerEditController editor); // 玩家开始注视时触发 + // void OnGazeExit(PlayerEditController editor); // 玩家停止注视时触发 + // void BeginEdit(); + // void EndEdit(); + // List GetEditableComponents(); + // } } \ No newline at end of file diff --git a/Assets/Script/Gameplay/Player/PlayerEditController.cs b/Assets/Script/Gameplay/Player/PlayerEditController.cs index 105b560..2350df4 100644 --- a/Assets/Script/Gameplay/Player/PlayerEditController.cs +++ b/Assets/Script/Gameplay/Player/PlayerEditController.cs @@ -12,11 +12,11 @@ namespace Script.Gameplay.Player [SerializeField] private FirstPersonRaycaster raycaster; // 新增:第一人称射线检测器 public bool IsEnableEditing = true; // 是否启用编辑功能 private bool isEditing = false; // 当前是否处于编辑状态 - public event Action OnBeginEditTarget; - public event Action OnEndEditTarget; + public event Action OnBeginEditTarget; + public event Action OnEndEditTarget; - private IEditable currentTarget; // 射线命中的当前可编辑对象(用于按键交互) - private IEditable previousGazedTarget; // 上一次注视的对象(用于注视进入/离开事件) + private GameObject currentTarget; // 射线命中的当前可编辑对象(用于按键交互) + private GameObject previousGazedTarget; // 上一次注视的对象(用于注视进入/离开事件) private InputManager inputManager; @@ -43,20 +43,27 @@ namespace Script.Gameplay.Player void DetectInteractable() { if (raycaster == null) return; + GameObject lookAtObj = raycaster.CurrentLookAtObject; - IEditable hitEditable = lookAtObj != null ? lookAtObj.GetComponent() : null; - + if(lookAtObj == null) return; + + GameObject hitEditable = null; + if (lookAtObj.GetComponent() != null) + { + hitEditable = lookAtObj; + } + // 如果命中对象与之前注视的不一样,触发进入/离开事件 if (hitEditable != previousGazedTarget) { if (previousGazedTarget != null) { - previousGazedTarget.OnGazeExit(this); + // previousGazedTarget.OnGazeExit(this); } if (hitEditable != null) { - hitEditable.OnGazeEnter(this); + // hitEditable.OnGazeEnter(this); } previousGazedTarget = hitEditable; @@ -65,11 +72,6 @@ namespace Script.Gameplay.Player currentTarget = hitEditable; } - public IEditable GetCurrentTarget() - { - return currentTarget; - } - private void EditTarget() { if (isEditing) diff --git a/Assets/Script/Gameplay/UI/PlayerEditViewer.cs b/Assets/Script/Gameplay/UI/PlayerEditViewer.cs index d5229ba..a331dbc 100644 --- a/Assets/Script/Gameplay/UI/PlayerEditViewer.cs +++ b/Assets/Script/Gameplay/UI/PlayerEditViewer.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using Core; +using Script.Gameplay.Edit; using Script.Gameplay.Interface; using Script.Gameplay.Player; using UnityEngine; @@ -26,13 +27,13 @@ namespace UI ControllerLocator.Instance.TryGetWait(OnGetPlayerEditController); } - public void OnBeginEdit(IEditable target) + public void OnBeginEdit(GameObject target) { this.gameObject.SetActive(true); if (target != null) { ClearComponentUI(); - GenerateComponentUI(GetEditableComponentsFromEditable(target)); + GenerateComponentUI(EditableManager.GetEditableComponents(target)); } else { @@ -43,7 +44,7 @@ namespace UI } } - public void OnEndEdit(IEditable target) + public void OnEndEdit(GameObject target) { this.gameObject.SetActive(false); @@ -63,19 +64,6 @@ namespace UI //Debug.Log("PlayerEditViewer obtained PlayerEditController."); } - private List GetEditableComponentsFromEditable(IEditable target) - { - if (target == null) - { - Debug.Log($"editable is null in {nameof(PlayerEditViewer)}"); - return null; - } - - return target.GetEditableComponents() - .Where(c => c != null) - .ToList(); - } - private void ClearComponentUI() { foreach (var viewer in componentViewers)