Some new inventory things. Work in progress.

This commit is contained in:
That-One-Nerd 2025-01-10 11:06:53 -05:00
parent 4f9db7174e
commit 6f1d71d68e
14 changed files with 752 additions and 34 deletions

View File

@ -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}

View File

@ -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:

View File

@ -1,7 +1,8 @@
fileFormatVersion: 2
guid: ecba4d6b0d9d5f14cb7163f8bee51a40
TextScriptImporter:
guid: 8b0285ffb9a559e4c9a618a7d8fa3924
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +1,16 @@
using System;
using UnityEngine;
public class ItemBase : MonoBehaviour
[Serializable]
public class ItemBase : IEquatable<ItemBase>
{
public string HumanName;
public string Id;
[TextArea]
public string Description;
public int MaxSlotSize;
public virtual bool Equals(ItemBase other) => Id == other.Id;
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d742d836e8123b141b0e8104eba721f4
guid: 329dd466a5398d0488adf652216b68fb
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -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<PlayerController>();
sr = GetComponent<SpriteRenderer>();
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() { }
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d742d836e8123b141b0e8104eba721f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
using System;
[Serializable]
public class ItemSlot
{
public ItemBase Item;
public int Count;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 27293a98a9292a444acdaa608a00bab8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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.
}
}

View File

@ -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)

View File

@ -0,0 +1,9 @@
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class PlayerInventory : ScriptableObject
{
public int MaxSpace;
public List<ItemSlot> ItemSlots;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 51a0c90199131db459c8aae050b6f2c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,9 +8,10 @@ public class HealthBar : MonoBehaviour
private RectTransform rectTransform;
private RectTransform bar;
private RectTransform mainBar;
private TextMeshProUGUI text;
private List<RectTransform> bars;
private RectTransform border;
private PlayerController player;
@ -18,7 +19,7 @@ public class HealthBar : MonoBehaviour
{
rectTransform = GetComponent<RectTransform>();
bar = transform.Find("Range").GetComponent<RectTransform>();
mainBar = transform.Find("Range").GetComponent<RectTransform>();
bars = new List<RectTransform>();
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<RectTransform>());
}
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<PlayerController>();
text = bar.Find("Display").GetComponent<TextMeshProUGUI>();
text = mainBar.Find("Display").GetComponent<TextMeshProUGUI>();
border = transform.Find("Border").GetComponent<RectTransform>();
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;
}
}