From 4397ec0326dfcc1d9a76e556d06d0aaead234050 Mon Sep 17 00:00:00 2001 From: Novvator Date: Fri, 19 Feb 2021 15:14:14 +0000 Subject: [PATCH] Changed Artefact and ArtefactInventory to Scriptable objects Added artefact prefab --- game/Assets/Prefabs.meta | 8 + game/Assets/Prefabs/Artefacts.meta | 8 + game/Assets/Prefabs/Artefacts/Artefact.prefab | 222 +++++++ .../Prefabs/Artefacts/Artefact.prefab.meta | 7 + game/Assets/Scenes/Main.unity | 615 ++++-------------- game/Assets/Scripts/Artefacts/Artefact.cs | 70 +- .../Scripts/Artefacts/ArtefactControl.cs | 81 +++ .../Scripts/Artefacts/ArtefactControl.cs.meta | 11 + .../Scripts/Artefacts/ArtefactInventory.cs | 4 +- .../Scripts/Artefacts/ArtefactObjects.meta | 8 + .../Artefacts/ArtefactObjects/Artefact1.asset | 16 + .../ArtefactObjects/Artefact1.asset.meta | 8 + .../Artefacts/ArtefactObjects/Artefact2.asset | 16 + .../ArtefactObjects/Artefact2.asset.meta | 8 + .../Scripts/Artefacts/ArtefactTriggerArea.cs | 11 +- .../Scripts/Player/PlayerInputHandler.cs | 13 +- 16 files changed, 548 insertions(+), 558 deletions(-) create mode 100644 game/Assets/Prefabs.meta create mode 100644 game/Assets/Prefabs/Artefacts.meta create mode 100644 game/Assets/Prefabs/Artefacts/Artefact.prefab create mode 100644 game/Assets/Prefabs/Artefacts/Artefact.prefab.meta create mode 100644 game/Assets/Scripts/Artefacts/ArtefactControl.cs create mode 100644 game/Assets/Scripts/Artefacts/ArtefactControl.cs.meta create mode 100644 game/Assets/Scripts/Artefacts/ArtefactObjects.meta create mode 100644 game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact1.asset create mode 100644 game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact1.asset.meta create mode 100644 game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact2.asset create mode 100644 game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact2.asset.meta diff --git a/game/Assets/Prefabs.meta b/game/Assets/Prefabs.meta new file mode 100644 index 0000000..1d56072 --- /dev/null +++ b/game/Assets/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: daa7df1d74482674f9d3277a44cd93bd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Prefabs/Artefacts.meta b/game/Assets/Prefabs/Artefacts.meta new file mode 100644 index 0000000..5b51fe7 --- /dev/null +++ b/game/Assets/Prefabs/Artefacts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ba1397828f5976449e5413e38108cfd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Prefabs/Artefacts/Artefact.prefab b/game/Assets/Prefabs/Artefacts/Artefact.prefab new file mode 100644 index 0000000..ef771f9 --- /dev/null +++ b/game/Assets/Prefabs/Artefacts/Artefact.prefab @@ -0,0 +1,222 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8781564213167799763 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8781564213167799764} + - component: {fileID: 8781564213167799767} + - component: {fileID: 8781564213167799766} + - component: {fileID: 8781564213167799761} + - component: {fileID: 8781564214016862072} + m_Layer: 0 + m_Name: New Artefact + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8781564213167799764 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564213167799763} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1.38, y: 0.5, z: 38.53155} + m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} + m_Children: + - {fileID: 8781564214893312960} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &8781564213167799767 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564213167799763} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &8781564213167799766 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564213167799763} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!136 &8781564213167799761 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564213167799763} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + m_Radius: 0.5000001 + m_Height: 2 + m_Direction: 1 + m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} +--- !u!114 &8781564214016862072 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564213167799763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7d3ed39e75807bc4d865f39b2ef9ea69, type: 3} + m_Name: + m_EditorClassIdentifier: + data: {fileID: 0} +--- !u!1 &8781564214893312975 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8781564214893312960} + - component: {fileID: 8781564214893312963} + - component: {fileID: 8781564214893312962} + - component: {fileID: 8781564214893312973} + - component: {fileID: 8781564214893312972} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8781564214893312960 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564214893312975} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 2, y: 2, z: 2} + m_Children: [] + m_Father: {fileID: 8781564213167799764} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &8781564214893312963 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564214893312975} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &8781564214893312962 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564214893312975} + m_Enabled: 0 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!135 &8781564214893312973 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564214893312975} + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 4 + m_Center: {x: 0, y: 0, z: 0} +--- !u!114 &8781564214893312972 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8781564214893312975} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 44966bb2b773ce145a9d6c7c9f42aeba, type: 3} + m_Name: + m_EditorClassIdentifier: + _id: 0 diff --git a/game/Assets/Prefabs/Artefacts/Artefact.prefab.meta b/game/Assets/Prefabs/Artefacts/Artefact.prefab.meta new file mode 100644 index 0000000..41e2b51 --- /dev/null +++ b/game/Assets/Prefabs/Artefacts/Artefact.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2dae894ec500e524a88f985657f9682d +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Scenes/Main.unity b/game/Assets/Scenes/Main.unity index 0cdccbd..c690443 100644 --- a/game/Assets/Scenes/Main.unity +++ b/game/Assets/Scenes/Main.unity @@ -164,117 +164,73 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 9 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &183708901 -GameObject: +--- !u!1001 &117285705 +PrefabInstance: m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 183708906} - - component: {fileID: 183708905} - - component: {fileID: 183708904} - - component: {fileID: 183708903} - - component: {fileID: 183708902} - m_Layer: 0 - m_Name: Sphere - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &183708902 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 183708901} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 44966bb2b773ce145a9d6c7c9f42aeba, type: 3} - m_Name: - m_EditorClassIdentifier: - id: 0 ---- !u!135 &183708903 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 183708901} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 serializedVersion: 2 - m_Radius: 4 - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &183708904 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 183708901} - m_Enabled: 0 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &183708905 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 183708901} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &183708906 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 183708901} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 2, y: 2, z: 2} - m_Children: [] - m_Father: {fileID: 1881828094} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 8781564213167799763, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_Name + value: Artefact1 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_RootOrder + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalPosition.x + value: -1.38 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalPosition.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalPosition.z + value: 38.53155 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564214016862072, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: data + value: + objectReference: {fileID: 11400000, guid: 38f76e60d5df1d445a455c63a88da8e1, type: 2} + - target: {fileID: 8781564214893312972, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: _id + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 2dae894ec500e524a88f985657f9682d, type: 3} --- !u!1 &349701919 GameObject: m_ObjectHideFlags: 0 @@ -891,6 +847,71 @@ Rigidbody: m_Interpolate: 0 m_Constraints: 112 m_CollisionDetection: 1 +--- !u!1001 &1390721954 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 8781564213167799763, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_Name + value: Artefact2 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_RootOrder + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalPosition.x + value: -22.13 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalPosition.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalPosition.z + value: 38.53155 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8781564214016862072, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: data + value: + objectReference: {fileID: 11400000, guid: 4c18fa3513891124282e56285b09c211, type: 2} + - target: {fileID: 8781564214893312972, guid: 2dae894ec500e524a88f985657f9682d, type: 3} + propertyPath: _id + value: 2 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 2dae894ec500e524a88f985657f9682d, type: 3} --- !u!1 &1444606336 GameObject: m_ObjectHideFlags: 0 @@ -1198,162 +1219,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1553332533 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1553332535} - - component: {fileID: 1553332534} - m_Layer: 0 - m_Name: Inventory - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1553332534 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1553332533} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 6be0ffc922ae4ac4cb7568e04674a61c, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!4 &1553332535 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1553332533} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.079972744, y: -0.13946426, z: 32.651897} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 8 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1881828089 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1881828094} - - component: {fileID: 1881828093} - - component: {fileID: 1881828092} - - component: {fileID: 1881828091} - - component: {fileID: 1881828090} - m_Layer: 0 - m_Name: Artefact - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1881828090 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1881828089} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e26cf8dbdb474db49ac6dadf49ceade2, type: 3} - m_Name: - m_EditorClassIdentifier: - artefactID: 0 - artefactDialogue: - canInteract: 0 ---- !u!136 &1881828091 -CapsuleCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1881828089} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - m_Radius: 0.5000001 - m_Height: 2 - m_Direction: 1 - m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} ---- !u!23 &1881828092 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1881828089} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &1881828093 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1881828089} - m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1881828094 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1881828089} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -1.38, y: 0.5, z: 38.53155} - m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} - m_Children: - - {fileID: 183708906} - m_Father: {fileID: 0} - m_RootOrder: 10 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1908415559 GameObject: m_ObjectHideFlags: 0 @@ -1449,225 +1314,3 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1932564749 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1932564754} - - component: {fileID: 1932564753} - - component: {fileID: 1932564752} - - component: {fileID: 1932564751} - - component: {fileID: 1932564750} - m_Layer: 0 - m_Name: Artefact (1) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1932564750 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1932564749} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e26cf8dbdb474db49ac6dadf49ceade2, type: 3} - m_Name: - m_EditorClassIdentifier: - artefactID: 1 - artefactDialogue: - canInteract: 0 ---- !u!136 &1932564751 -CapsuleCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1932564749} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - m_Radius: 0.5000001 - m_Height: 2 - m_Direction: 1 - m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} ---- !u!23 &1932564752 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1932564749} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &1932564753 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1932564749} - m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1932564754 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1932564749} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -12, y: 0.5, z: 46.5} - m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} - m_Children: - - {fileID: 2142420295} - m_Father: {fileID: 0} - m_RootOrder: 11 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &2142420290 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2142420295} - - component: {fileID: 2142420294} - - component: {fileID: 2142420293} - - component: {fileID: 2142420292} - - component: {fileID: 2142420291} - m_Layer: 0 - m_Name: Sphere (1) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &2142420291 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2142420290} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 44966bb2b773ce145a9d6c7c9f42aeba, type: 3} - m_Name: - m_EditorClassIdentifier: - id: 1 ---- !u!135 &2142420292 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2142420290} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 4 - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &2142420293 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2142420290} - m_Enabled: 0 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &2142420294 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2142420290} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &2142420295 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2142420290} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 2, y: 2, z: 2} - m_Children: [] - m_Father: {fileID: 1932564754} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/game/Assets/Scripts/Artefacts/Artefact.cs b/game/Assets/Scripts/Artefacts/Artefact.cs index 82e2125..0dd12c1 100644 --- a/game/Assets/Scripts/Artefacts/Artefact.cs +++ b/game/Assets/Scripts/Artefacts/Artefact.cs @@ -2,68 +2,18 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class Artefact : MonoBehaviour +[CreateAssetMenu(fileName = "New Artefact", menuName = "Artefact", order = 51)] +public class Artefact : ScriptableObject { - public int artefactID; - public enum Type { PhysicalArtefact, PowerArtefact, WrittenArtefact } - public string artefactDialogue; + public int artefactID => _artefactID; + [SerializeField] private int _artefactID; + public string artefactDialogue => _artefactDialogue; + [SerializeField] private string _artefactDialogue; - private bool show = false; - public bool canInteract = false; - - private void Start() - { - EventHandler.current.onArtefactTriggerEnter += NearArtefact; - EventHandler.current.onArtefactTriggerExit += AwayArtefact; - EventHandler.current.onArtefactPickUp += PickUp; - } - - private void NearArtefact(int id) - { - if(id == this.artefactID) - { - show = true; - this.canInteract = true; - } - - } - - private void AwayArtefact(int id) - { - if(id == this.artefactID) - { - show = false; - this.canInteract = false; - } - - } - - private void PickUp(int id) - { - if (id == this.artefactID) - { - if ( canInteract == true ) - { - foreach (var x in ArtefactInventory.artefactList) - { - Debug.Log(x.ToString()); - } - ArtefactInventory.addA(this); - } - //show artifact dialogue - - - } - } - - - void OnGUI() - { - if(show) - { - GUI.Label(new Rect(Screen.width / 2 - 50, 5, 100, 100), "Press E to pickup"); - } - } + public bool show => _show; + private bool _show = false; + public bool canInteract => _canInteract; + private bool _canInteract = false; } \ No newline at end of file diff --git a/game/Assets/Scripts/Artefacts/ArtefactControl.cs b/game/Assets/Scripts/Artefacts/ArtefactControl.cs new file mode 100644 index 0000000..6c5e645 --- /dev/null +++ b/game/Assets/Scripts/Artefacts/ArtefactControl.cs @@ -0,0 +1,81 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ArtefactControl : MonoBehaviour +{ + + + private bool _show; + private bool _canInteract; + + [SerializeField] + private Artefact data; + public int artefactID => _artefactID; + private int _artefactID; + private string _artefactDialogue; + + private void Start() + { + _artefactID = data.artefactID; + _artefactDialogue = data.artefactDialogue; + _show = data.show; + _canInteract = data.canInteract; + + EventHandler.current.onArtefactTriggerEnter += NearArtefact; + EventHandler.current.onArtefactTriggerExit += AwayArtefact; + EventHandler.current.onArtefactPickUp += PickUp; + } + + private void NearArtefact(int id) + { + if (id == this._artefactID) + { + _show = true; + this._canInteract = true; + } + + } + + private void AwayArtefact(int id) + { + if (id == this._artefactID) + { + _show = false; + this._canInteract = false; + } + + } + + private void PickUp(int id) + { + if (id == this._artefactID) + { + if (_canInteract == true) + { + ArtefactInventory.addA(data); + foreach (var x in ArtefactInventory.artefactList) + { + Debug.Log(x.ToString()); + } + + } + //here put 'show artifact dialogue' + if (this.gameObject != null) + Destroy(this.gameObject); + PlayerInputHandler.id = 0; + + + + } + } + + + void OnGUI() + { + if (_show) + { + GUI.Label(new Rect(Screen.width / 2 - 50, 5, 100, 100), "Press E to pickup"); + } + } +} diff --git a/game/Assets/Scripts/Artefacts/ArtefactControl.cs.meta b/game/Assets/Scripts/Artefacts/ArtefactControl.cs.meta new file mode 100644 index 0000000..45935fa --- /dev/null +++ b/game/Assets/Scripts/Artefacts/ArtefactControl.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7d3ed39e75807bc4d865f39b2ef9ea69 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Scripts/Artefacts/ArtefactInventory.cs b/game/Assets/Scripts/Artefacts/ArtefactInventory.cs index 12de86b..6c64d57 100644 --- a/game/Assets/Scripts/Artefacts/ArtefactInventory.cs +++ b/game/Assets/Scripts/Artefacts/ArtefactInventory.cs @@ -3,7 +3,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class ArtefactInventory : MonoBehaviour +public class ArtefactInventory : ScriptableObject { public static List artefactList = new List(); private static bool exists = false; @@ -23,8 +23,6 @@ public class ArtefactInventory : MonoBehaviour artefactList.Add(a); } - - } diff --git a/game/Assets/Scripts/Artefacts/ArtefactObjects.meta b/game/Assets/Scripts/Artefacts/ArtefactObjects.meta new file mode 100644 index 0000000..a24305e --- /dev/null +++ b/game/Assets/Scripts/Artefacts/ArtefactObjects.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 73c4cfa51bc2a6b40810cb5b784f15a8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact1.asset b/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact1.asset new file mode 100644 index 0000000..4f059fd --- /dev/null +++ b/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact1.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e26cf8dbdb474db49ac6dadf49ceade2, type: 3} + m_Name: Artefact1 + m_EditorClassIdentifier: + _artefactID: 1 + _artefactDialogue: diff --git a/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact1.asset.meta b/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact1.asset.meta new file mode 100644 index 0000000..dc14766 --- /dev/null +++ b/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact1.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 38f76e60d5df1d445a455c63a88da8e1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact2.asset b/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact2.asset new file mode 100644 index 0000000..b7b438e --- /dev/null +++ b/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact2.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e26cf8dbdb474db49ac6dadf49ceade2, type: 3} + m_Name: Artefact2 + m_EditorClassIdentifier: + _artefactID: 2 + _artefactDialogue: diff --git a/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact2.asset.meta b/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact2.asset.meta new file mode 100644 index 0000000..bd46cf9 --- /dev/null +++ b/game/Assets/Scripts/Artefacts/ArtefactObjects/Artefact2.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4c18fa3513891124282e56285b09c211 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Scripts/Artefacts/ArtefactTriggerArea.cs b/game/Assets/Scripts/Artefacts/ArtefactTriggerArea.cs index 191cd72..22d3223 100644 --- a/game/Assets/Scripts/Artefacts/ArtefactTriggerArea.cs +++ b/game/Assets/Scripts/Artefacts/ArtefactTriggerArea.cs @@ -4,16 +4,19 @@ using UnityEngine; public class ArtefactTriggerArea : MonoBehaviour { - public int id; + public int id => _id; + [SerializeField] private int _id; + private void OnTriggerEnter(Collider Player) { - EventHandler.current.ArtefactTriggerEnter(id); - PlayerInputHandler.id = id; + EventHandler.current.ArtefactTriggerEnter(_id); + PlayerInputHandler.id = _id; } private void OnTriggerExit(Collider Player) { - EventHandler.current.ArtefactTriggerExit(id); + EventHandler.current.ArtefactTriggerExit(_id); + PlayerInputHandler.id = 0; } } \ No newline at end of file diff --git a/game/Assets/Scripts/Player/PlayerInputHandler.cs b/game/Assets/Scripts/Player/PlayerInputHandler.cs index edb6bc5..cba0442 100644 --- a/game/Assets/Scripts/Player/PlayerInputHandler.cs +++ b/game/Assets/Scripts/Player/PlayerInputHandler.cs @@ -7,7 +7,12 @@ using UnityEngine.InputSystem; public class PlayerInputHandler : MonoBehaviour { //to get the artifact id you are near to - public static int id; + private static int _id; + public static int id + { + get { return _id; } + set { _id = value; } + } [SerializeField] private PlayerInputSettings _inputSettings; @@ -55,11 +60,9 @@ public class PlayerInputHandler : MonoBehaviour public void Jump(InputAction.CallbackContext context) => _state.Jump.Set(context.ReadValue() > 0.5f); - // public void Use( InputAction.CallbackContext context ) - // => _state.Use.Set( context.ReadValue() > 0.5f ); public void Use(InputAction.CallbackContext context) { - //Debug.Log("pressed e"); - EventHandler.current.ArtefactPickUp(id); + if(context.started) + EventHandler.current.ArtefactPickUp(_id); } } \ No newline at end of file