From 099d1aacd1defef4faf9278862f5f948278c21db Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 18 Oct 2024 19:42:32 +0200 Subject: [PATCH] add interaction points provider --- .../Engineering/PacManGenerator.prefab | 86 ++++++++++++++++++- .../Machines/Engineering/SMES.prefab | 48 +++++++++++ .../GenericToggleInteractionTarget.cs | 15 +--- 3 files changed, 134 insertions(+), 15 deletions(-) diff --git a/Assets/Content/WorldObjects/Furniture/Machines/Engineering/PacManGenerator.prefab b/Assets/Content/WorldObjects/Furniture/Machines/Engineering/PacManGenerator.prefab index cebf7a618..563710b2b 100644 --- a/Assets/Content/WorldObjects/Furniture/Machines/Engineering/PacManGenerator.prefab +++ b/Assets/Content/WorldObjects/Furniture/Machines/Engineering/PacManGenerator.prefab @@ -1,5 +1,67 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &95087872037303502 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6129818498246833444} + m_Layer: 0 + m_Name: StartPoint + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6129818498246833444 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 95087872037303502} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.238, y: 0.715, z: 0.218} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8033135651520204425} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &178617126351056782 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5465962008692022609} + m_Layer: 0 + m_Name: StartPoint2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5465962008692022609 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 178617126351056782} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.256, y: 0.713, z: 0.22} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8033135651520204425} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1918783493706165866 GameObject: m_ObjectHideFlags: 0 @@ -17,6 +79,7 @@ GameObject: - component: {fileID: -2157900375506616301} - component: {fileID: 7239473696267242548} - component: {fileID: 4189468537532167386} + - component: {fileID: 1380082131058378985} m_Layer: 0 m_Name: PacManGenerator m_TagString: Untagged @@ -38,6 +101,8 @@ Transform: m_Children: - {fileID: 608453462504062702} - {fileID: 758939287750849531} + - {fileID: 6129818498246833444} + - {fileID: 5465962008692022609} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -59,6 +124,7 @@ MonoBehaviour: _networkBehaviours: - {fileID: 219113547575591534} - {fileID: -2157900375506616301} + - {fileID: 4189468537532167386} k__BackingField: {fileID: 0} k__BackingField: [] SerializedTransformProperties: @@ -172,10 +238,26 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b621d3404247f2e4da4ab459ad43eec7, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 2 _addedNetworkObject: {fileID: -5414623717715724467} - _networkObjectCache: {fileID: 0} + _networkObjectCache: {fileID: -5414623717715724467} _on: 0 + _toggle: {fileID: 0} +--- !u!114 &1380082131058378985 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1918783493706165866} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e9b1134be21b33843967f48258787c1b, type: 3} + m_Name: + m_EditorClassIdentifier: + _interactionPoints: + - {fileID: 6129818498246833444} + - {fileID: 5465962008692022609} --- !u!1 &4271595947011161493 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Content/WorldObjects/Furniture/Machines/Engineering/SMES.prefab b/Assets/Content/WorldObjects/Furniture/Machines/Engineering/SMES.prefab index 506822837..b6a735e88 100644 --- a/Assets/Content/WorldObjects/Furniture/Machines/Engineering/SMES.prefab +++ b/Assets/Content/WorldObjects/Furniture/Machines/Engineering/SMES.prefab @@ -16,6 +16,7 @@ GameObject: - component: {fileID: -7870356800615129184} - component: {fileID: 4840393447774820463} - component: {fileID: 8399519541836331320} + - component: {fileID: 5915189518970650810} m_Layer: 0 m_Name: SMES m_TagString: Untagged @@ -36,6 +37,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 608453462504062702} + - {fileID: 7499286863265064138} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -164,6 +166,21 @@ MonoBehaviour: _addedNetworkObject: {fileID: -5414623717715724467} _networkObjectCache: {fileID: -5414623717715724467} _on: 0 + _toggle: {fileID: 0} +--- !u!114 &5915189518970650810 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1918783493706165866} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e9b1134be21b33843967f48258787c1b, type: 3} + m_Name: + m_EditorClassIdentifier: + _interactionPoints: + - {fileID: 7499286863265064138} --- !u!1 &4379219507269237858 GameObject: m_ObjectHideFlags: 0 @@ -264,3 +281,34 @@ SkinnedMeshRenderer: m_Center: {x: -0.000000014901161, y: 0.48807514, z: 0.025044113} m_Extent: {x: 0.41364294, y: 0.48807514, z: 0.43868694} m_DirtyAABB: 0 +--- !u!1 &8679078277714624616 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7499286863265064138} + m_Layer: 0 + m_Name: StartPoint + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7499286863265064138 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8679078277714624616} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.061, y: 0.655, z: 0.454} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8033135651520204425} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/SS3D/Systems/Interactions/GenericToggleInteractionTarget.cs b/Assets/Scripts/SS3D/Systems/Interactions/GenericToggleInteractionTarget.cs index 6e47985e3..a2b3553ed 100644 --- a/Assets/Scripts/SS3D/Systems/Interactions/GenericToggleInteractionTarget.cs +++ b/Assets/Scripts/SS3D/Systems/Interactions/GenericToggleInteractionTarget.cs @@ -1,6 +1,7 @@ using FishNet.Object.Synchronizing; using SS3D.Core.Behaviours; using SS3D.Interactions; +using SS3D.Interactions.Extensions; using SS3D.Interactions.Interfaces; using System; using System.Collections.Generic; @@ -30,19 +31,7 @@ public IInteraction[] CreateTargetInteractions(InteractionEvent interactionEvent return interactions.ToArray(); } - public bool TryGetInteractionPoint(IInteractionSource source, out Vector3 point) - { - point = Vector3.zero; - - if (_toggle != null) - { - point = _toggle.position; - - return true; - } - - return false; - } + public bool TryGetInteractionPoint(IInteractionSource source, out Vector3 point) => this.GetInteractionPoint(source, out point); public bool GetState() {