diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index b60461f..ea9896e 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -153,7 +153,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1982289467} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -359,6 +359,178 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &609266256 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 609266259} + - component: {fileID: 609266258} + - component: {fileID: 609266257} + m_Layer: 0 + m_Name: TestItem (3) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &609266257 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 609266256} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.16, y: 0.16} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &609266258 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 609266256} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d742d836e8123b141b0e8104eba721f4, type: 3} + m_Name: + m_EditorClassIdentifier: + PickupDistance: 1.5 + PickupSize: 1.375 + ItemData: + HumanName: Cool Item + Description: No Description +--- !u!4 &609266259 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 609266256} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -8.04, y: 0.6500001, z: 0} + m_LocalScale: {x: 0.5, y: 0.5, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &679714723 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 679714724} + - component: {fileID: 679714726} + - component: {fileID: 679714725} + m_Layer: 5 + m_Name: Vertical + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &679714724 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 679714723} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1062579970} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -4, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &679714725 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 679714723} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 0} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!222 &679714726 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 679714723} + m_CullTransparentMesh: 1 --- !u!1 &754085557 GameObject: m_ObjectHideFlags: 0 @@ -421,6 +593,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: BaseStats: {fileID: 11400000, guid: 327779ba20a967442b19ba7bb367cf59, type: 2} + Inventory: {fileID: 11400000, guid: 8b0285ffb9a559e4c9a618a7d8fa3924, type: 2} Room: {fileID: 0} Speed: 5 CurrentHealth: 100 @@ -542,7 +715,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1982289467} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -584,6 +757,143 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 943628639} m_CullTransparentMesh: 1 +--- !u!1 &1062579969 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1062579970} + m_Layer: 5 + m_Name: Border + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1062579970 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1062579969} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1684527724} + - {fileID: 679714724} + m_Father: {fileID: 1982289467} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -2} + m_SizeDelta: {x: 4, y: 8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1122942061 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1122942064} + - component: {fileID: 1122942063} + - component: {fileID: 1122942062} + m_Layer: 0 + m_Name: TestItem (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1122942062 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1122942061} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.16, y: 0.16} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1122942063 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1122942061} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d742d836e8123b141b0e8104eba721f4, type: 3} + m_Name: + m_EditorClassIdentifier: + PickupDistance: 1.5 + PickupSize: 1.375 + ItemData: + HumanName: Cool Item + Description: No Description +--- !u!4 &1122942064 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1122942061} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5.29, y: 2.65, z: 0} + m_LocalScale: {x: 0.5, y: 0.5, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1293669682 GameObject: m_ObjectHideFlags: 0 @@ -597,7 +907,7 @@ GameObject: - component: {fileID: 1293669684} - component: {fileID: 1293669683} m_Layer: 5 - m_Name: Interface + m_Name: Heads Up Display m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -684,6 +994,106 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!1 &1316154634 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1316154637} + - component: {fileID: 1316154636} + - component: {fileID: 1316154635} + m_Layer: 0 + m_Name: TestItem (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1316154635 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1316154634} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.16, y: 0.16} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1316154636 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1316154634} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d742d836e8123b141b0e8104eba721f4, type: 3} + m_Name: + m_EditorClassIdentifier: + PickupDistance: 1.5 + PickupSize: 1.375 + ItemData: + HumanName: Cool Item + Description: No Description +--- !u!4 &1316154637 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1316154634} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -3.04, y: -3.1, z: 0} + m_LocalScale: {x: 0.5, y: 0.5, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1380888464 GameObject: m_ObjectHideFlags: 0 @@ -828,6 +1238,7 @@ GameObject: m_Component: - component: {fileID: 1437794938} - component: {fileID: 1437794937} + - component: {fileID: 1437794939} m_Layer: 0 m_Name: TestItem m_TagString: Untagged @@ -847,8 +1258,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d742d836e8123b141b0e8104eba721f4, type: 3} m_Name: m_EditorClassIdentifier: - HumanName: - Description: + PickupDistance: 1.5 + PickupSize: 1.375 + ItemData: + HumanName: Cool Item + Description: No Description --- !u!4 &1437794938 Transform: m_ObjectHideFlags: 0 @@ -857,12 +1271,135 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1437794936} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalPosition: {x: -6.29, y: -1.6, z: 0} + m_LocalScale: {x: 0.5, y: 0.5, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1437794939 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437794936} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.16, y: 0.16} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1684527723 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1684527724} + - component: {fileID: 1684527726} + - component: {fileID: 1684527725} + m_Layer: 5 + m_Name: Horizontal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1684527724 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1684527723} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1062579970} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: -4} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1684527725 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1684527723} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 0} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!222 &1684527726 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1684527723} + m_CullTransparentMesh: 1 --- !u!1 &1715515646 GameObject: m_ObjectHideFlags: 0 @@ -894,7 +1431,7 @@ RectTransform: m_Children: - {fileID: 1380888465} m_Father: {fileID: 1982289467} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1015,6 +1552,7 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: + - {fileID: 1062579970} - {fileID: 943628640} - {fileID: 457514476} - {fileID: 1715515647} diff --git a/Assets/Scriptables/PlayerInventory.asset b/Assets/Scriptables/PlayerInventory.asset new file mode 100644 index 0000000..739421d --- /dev/null +++ b/Assets/Scriptables/PlayerInventory.asset @@ -0,0 +1,18 @@ +%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: 51a0c90199131db459c8aae050b6f2c7, type: 3} + m_Name: PlayerInventory + m_EditorClassIdentifier: + MaxSpace: 2 + Items: + - HumanName: + Description: diff --git a/Assets/Scripts/RoomGeneration/GenerationProcedure.md.meta b/Assets/Scriptables/PlayerInventory.asset.meta similarity index 52% rename from Assets/Scripts/RoomGeneration/GenerationProcedure.md.meta rename to Assets/Scriptables/PlayerInventory.asset.meta index a5a8142..21937e4 100644 --- a/Assets/Scripts/RoomGeneration/GenerationProcedure.md.meta +++ b/Assets/Scriptables/PlayerInventory.asset.meta @@ -1,7 +1,8 @@ fileFormatVersion: 2 -guid: ecba4d6b0d9d5f14cb7163f8bee51a40 -TextScriptImporter: +guid: 8b0285ffb9a559e4c9a618a7d8fa3924 +NativeFormatImporter: externalObjects: {} + mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Scripts/Items/ItemBase.cs b/Assets/Scripts/Items/ItemBase.cs index 8bc140d..caf1286 100644 --- a/Assets/Scripts/Items/ItemBase.cs +++ b/Assets/Scripts/Items/ItemBase.cs @@ -1,9 +1,16 @@ +using System; using UnityEngine; -public class ItemBase : MonoBehaviour +[Serializable] +public class ItemBase : IEquatable { public string HumanName; + public string Id; [TextArea] public string Description; + + public int MaxSlotSize; + + public virtual bool Equals(ItemBase other) => Id == other.Id; } diff --git a/Assets/Scripts/Items/ItemBase.cs.meta b/Assets/Scripts/Items/ItemBase.cs.meta index 633b6b8..7b3ad26 100644 --- a/Assets/Scripts/Items/ItemBase.cs.meta +++ b/Assets/Scripts/Items/ItemBase.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d742d836e8123b141b0e8104eba721f4 +guid: 329dd466a5398d0488adf652216b68fb MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Items/ItemGameObject.cs b/Assets/Scripts/Items/ItemGameObject.cs new file mode 100644 index 0000000..1a97f9f --- /dev/null +++ b/Assets/Scripts/Items/ItemGameObject.cs @@ -0,0 +1,84 @@ +using UnityEngine; + +public class ItemGameObject : MonoBehaviour +{ + public float PickupDistance = 1.5f; + public float PickupSize = 1.375f; + public ItemBase ItemData; + + public bool Collected { get; protected set; } + + private PlayerController player; + private SpriteRenderer sr; + + private Vector2 initialSize; + + private void Awake() + { + player = FindObjectOfType(); + sr = GetComponent(); + + initialSize = transform.localScale; + } + + private bool lastCouldPickup; + + private void Update() + { + float desiredSize, pickupDistSqr = PickupDistance * PickupDistance; + + Vector2 diff = player.transform.position - transform.position; + float diffMagSqr = diff.x * diff.x + diff.y * diff.y; + if (!Collected && diffMagSqr <= pickupDistSqr) + { + if (!lastCouldPickup) OnEnterPickupRange(); + OnStayPickupRange(); + + desiredSize = PickupSize; + lastCouldPickup = true; + if (Input.GetKeyDown(KeyCode.Space)) + { + if (player.TryPickupItem(ItemData)) + { + desiredSize = 1; + OnPickup(); + } + else OnPickupFailed(); + } + } + else + { + if (lastCouldPickup) OnExitPickupRange(); + + desiredSize = 1; + lastCouldPickup = false; + } + + transform.localScale = Vector2.Lerp(transform.localScale, initialSize * desiredSize, Time.deltaTime * 15); + + if (Collected) + { + Vector3 playerPos = player.transform.position, curPos = transform.position; + transform.position = Vector3.Lerp(curPos, playerPos, Time.deltaTime * 10); + + if (sr != null) + { + Color clearCol = new Color(sr.color.r, sr.color.g, sr.color.b, 0); + sr.color = Color.Lerp(sr.color, clearCol, Time.deltaTime * 10); + + if (sr.color.a <= 1e-3) Destroy(gameObject); + } + + if (diffMagSqr <= 1e-4) Destroy(gameObject); + } + } + + protected virtual void OnEnterPickupRange() { } + protected virtual void OnStayPickupRange() { } + protected virtual void OnExitPickupRange() { } + protected virtual void OnPickup() + { + Collected = true; + } + protected virtual void OnPickupFailed() { } +} diff --git a/Assets/Scripts/Items/ItemGameObject.cs.meta b/Assets/Scripts/Items/ItemGameObject.cs.meta new file mode 100644 index 0000000..633b6b8 --- /dev/null +++ b/Assets/Scripts/Items/ItemGameObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d742d836e8123b141b0e8104eba721f4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Items/ItemSlot.cs b/Assets/Scripts/Items/ItemSlot.cs new file mode 100644 index 0000000..e75b900 --- /dev/null +++ b/Assets/Scripts/Items/ItemSlot.cs @@ -0,0 +1,8 @@ +using System; + +[Serializable] +public class ItemSlot +{ + public ItemBase Item; + public int Count; +} diff --git a/Assets/Scripts/Items/ItemSlot.cs.meta b/Assets/Scripts/Items/ItemSlot.cs.meta new file mode 100644 index 0000000..f29f330 --- /dev/null +++ b/Assets/Scripts/Items/ItemSlot.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27293a98a9292a444acdaa608a00bab8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 0b8576a..be773f1 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -3,6 +3,7 @@ using UnityEngine; public class PlayerController : MonoBehaviour { public PlayerStats BaseStats; + public PlayerInventory Inventory; [Header("Movement")] public RoomObject Room; @@ -62,4 +63,34 @@ public class PlayerController : MonoBehaviour overhealTimer = 1; } } + + public bool TryPickupItem(ItemBase item) + { + // First, try and match the item with any other slot. + for (int i = 0; i < Inventory.ItemSlots.Count; i++) + { + ItemSlot slot = Inventory.ItemSlots[i]; + if (slot.Item == null || (slot.Item.Equals(item) && slot.Count < slot.Item.MaxSlotSize)) + { + // Item added to slot. + // If the Equals() is not handled correctly, + // this might overwrite metadata. + slot.Item = item; + slot.Count++; + return true; + } + } + + // It doesn't fit in a slot, try and make a new slot. + if (Inventory.ItemSlots.Count < Inventory.MaxSpace) + { + Inventory.ItemSlots.Add(new ItemSlot() + { + Item = item, + Count = 1 + }); + return true; + } + else return false; // No room to make a new slot, it doesn't fit. + } } diff --git a/Assets/Scripts/RoomGeneration/GenerationProcedure.md b/Assets/Scripts/RoomGeneration/GenerationProcedure.md deleted file mode 100644 index fd6a636..0000000 --- a/Assets/Scripts/RoomGeneration/GenerationProcedure.md +++ /dev/null @@ -1,18 +0,0 @@ -# Generation Procedure -This file details the algorithm I will be using to procedurally generate dungeons. -It's not super complex in the grand scheme of things, but I still felt the need to -write it out to help myself understand it before trying to implement it. - -## Properties - -### RoomObject -- Bounds -- Doors -- CanBeRotated - -### RoomDoor -- ParentRoom -- Corresponding -- Disabled -- Tags -- AllowedRoomTags (tags and weights) diff --git a/Assets/Scripts/ScriptableObjects/PlayerInventory.cs b/Assets/Scripts/ScriptableObjects/PlayerInventory.cs new file mode 100644 index 0000000..a0aa0f9 --- /dev/null +++ b/Assets/Scripts/ScriptableObjects/PlayerInventory.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; +using UnityEngine; + +[CreateAssetMenu] +public class PlayerInventory : ScriptableObject +{ + public int MaxSpace; + public List ItemSlots; +} diff --git a/Assets/Scripts/ScriptableObjects/PlayerInventory.cs.meta b/Assets/Scripts/ScriptableObjects/PlayerInventory.cs.meta new file mode 100644 index 0000000..367ba73 --- /dev/null +++ b/Assets/Scripts/ScriptableObjects/PlayerInventory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 51a0c90199131db459c8aae050b6f2c7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/HealthBar.cs b/Assets/Scripts/UI/HealthBar.cs index 67ebf88..d796210 100644 --- a/Assets/Scripts/UI/HealthBar.cs +++ b/Assets/Scripts/UI/HealthBar.cs @@ -8,9 +8,10 @@ public class HealthBar : MonoBehaviour private RectTransform rectTransform; - private RectTransform bar; + private RectTransform mainBar; private TextMeshProUGUI text; private List bars; + private RectTransform border; private PlayerController player; @@ -18,7 +19,7 @@ public class HealthBar : MonoBehaviour { rectTransform = GetComponent(); - bar = transform.Find("Range").GetComponent(); + mainBar = transform.Find("Range").GetComponent(); bars = new List(); for (int i = 0; i < transform.childCount; i++) { @@ -26,10 +27,11 @@ public class HealthBar : MonoBehaviour if (child.name.StartsWith("Overheal ")) bars.Add(child.GetComponent()); } bars.Sort((a, b) => int.Parse(a.name.Substring(9)).CompareTo(int.Parse(b.name.Substring(9)))); - bars.Insert(0, bar); + bars.Insert(0, mainBar); player = FindObjectOfType(); - text = bar.Find("Display").GetComponent(); + text = mainBar.Find("Display").GetComponent(); + border = transform.Find("Border").GetComponent(); Tick(true); } @@ -41,11 +43,13 @@ public class HealthBar : MonoBehaviour float size = Mathf.Log10(player.BaseStats.MaxHealth) * ScalingFactor; float desiredHealth = player.CurrentHealth; float ratio = desiredHealth / player.BaseStats.MaxHealth; + float borderSize = 4 + 2 * Mathf.Max(0, Mathf.Ceil(ratio - 1)); if (!instant) { desiredHealth = Mathf.Lerp(prevHealth, desiredHealth, Time.deltaTime * 5); ratio = desiredHealth / player.BaseStats.MaxHealth; + borderSize = Mathf.Lerp(border.sizeDelta.y, 4 + 2 * Mathf.Max(0, Mathf.Ceil(ratio - 1)), Time.deltaTime * 20); } for (int i = 0; i < bars.Count; i++) @@ -59,6 +63,9 @@ public class HealthBar : MonoBehaviour } text.text = Mathf.RoundToInt(desiredHealth).ToString(); + border.sizeDelta = new Vector2(border.sizeDelta.x, borderSize); + border.localPosition = new Vector2(border.localPosition.x, -2 - borderSize / 2); + prevHealth = desiredHealth; } }