feature: able to load a new save basic functionality and tile system start to implement

This commit is contained in:
unfaiyted 2024-06-26 10:46:42 -05:00
parent ac17a5f5c4
commit aab57c014f
55 changed files with 81234 additions and 69165 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1378,6 +1378,7 @@ GameObject:
- component: {fileID: 1716277278}
- component: {fileID: 1716277284}
- component: {fileID: 1716277277}
- component: {fileID: 1716277286}
- component: {fileID: 1716277285}
- component: {fileID: 1716277280}
- component: {fileID: 1716277281}
@ -1536,6 +1537,19 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
currentMap: {fileID: 0}
--- !u!114 &1716277286
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 485a16bcfbf74c7c8f289519efc1979c, type: 3}
m_Name:
m_EditorClassIdentifier:
tileSize: 32
--- !u!1 &2076652140
GameObject:
m_ObjectHideFlags: 0
@ -1615,6 +1629,66 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2076652140}
m_CullTransparentMesh: 1
--- !u!1001 &4772071642411593056
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.x
value: -2.499
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.y
value: -2.499
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8257118877032255596, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_Name
value: Tile
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 7848130704331449967, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
m_SourcePrefab: {fileID: 100100000, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@ -1622,3 +1696,4 @@ SceneRoots:
- {fileID: 672375811}
- {fileID: 111811052}
- {fileID: 1406866842}
- {fileID: 4772071642411593056}

View File

@ -1378,6 +1378,7 @@ GameObject:
- component: {fileID: 1716277278}
- component: {fileID: 1716277284}
- component: {fileID: 1716277277}
- component: {fileID: 1716277286}
- component: {fileID: 1716277285}
- component: {fileID: 1716277280}
- component: {fileID: 1716277281}
@ -1536,6 +1537,19 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
currentMap: {fileID: 0}
--- !u!114 &1716277286
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 485a16bcfbf74c7c8f289519efc1979c, type: 3}
m_Name:
m_EditorClassIdentifier:
tileSize: 32
--- !u!1 &2076652140
GameObject:
m_ObjectHideFlags: 0
@ -1615,6 +1629,66 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2076652140}
m_CullTransparentMesh: 1
--- !u!1001 &4772071642411593056
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.x
value: -2.499
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.y
value: -2.499
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8257118877032255596, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_Name
value: Tile
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 7848130704331449967, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
m_SourcePrefab: {fileID: 100100000, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@ -1622,3 +1696,4 @@ SceneRoots:
- {fileID: 672375811}
- {fileID: 111811052}
- {fileID: 1406866842}
- {fileID: 4772071642411593056}

View File

@ -217,7 +217,6 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2076652141}
- {fileID: 1716277275}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -1378,6 +1377,7 @@ GameObject:
- component: {fileID: 1716277278}
- component: {fileID: 1716277284}
- component: {fileID: 1716277277}
- component: {fileID: 1716277286}
- component: {fileID: 1716277285}
- component: {fileID: 1716277280}
- component: {fileID: 1716277281}
@ -1398,12 +1398,12 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
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_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 90}
m_LocalScale: {x: 0.013888889, y: 0.013888889, z: 0.013888889}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 111811052}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1536,6 +1536,19 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
currentMap: {fileID: 0}
--- !u!114 &1716277286
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 485a16bcfbf74c7c8f289519efc1979c, type: 3}
m_Name:
m_EditorClassIdentifier:
tileSize: 32
--- !u!1 &2076652140
GameObject:
m_ObjectHideFlags: 0
@ -1615,10 +1628,72 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2076652140}
m_CullTransparentMesh: 1
--- !u!1001 &4772071642411593056
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.x
value: -4.21
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.y
value: -0.57
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8257118877032255596, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_Name
value: Tile
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 7848130704331449967, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
m_SourcePrefab: {fileID: 100100000, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1716277275}
- {fileID: 672375811}
- {fileID: 111811052}
- {fileID: 1406866842}
- {fileID: 4772071642411593056}

View File

@ -217,7 +217,6 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2076652141}
- {fileID: 1716277275}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -261,7 +260,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 195, y: -100}
m_AnchoredPosition: {x: -170.39996, y: -98.40002}
m_SizeDelta: {x: 193.02, y: 48.01}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &539028779
@ -394,7 +393,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 195, y: -26}
m_AnchoredPosition: {x: -170.4, y: -24.400017}
m_SizeDelta: {x: 193.02, y: 48.01}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &638113162
@ -796,7 +795,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -10, y: -50.995}
m_AnchoredPosition: {x: -28, y: 44}
m_SizeDelta: {x: 475.22, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &762579829
@ -932,7 +931,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 195, y: -179}
m_AnchoredPosition: {x: -170.39996, y: -177.40002}
m_SizeDelta: {x: 193.02, y: 48.01}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &804445075
@ -1375,9 +1374,11 @@ GameObject:
m_Component:
- component: {fileID: 1716277275}
- component: {fileID: 1716277279}
- component: {fileID: 1716277287}
- component: {fileID: 1716277278}
- component: {fileID: 1716277284}
- component: {fileID: 1716277277}
- component: {fileID: 1716277286}
- component: {fileID: 1716277285}
- component: {fileID: 1716277280}
- component: {fileID: 1716277281}
@ -1398,12 +1399,12 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
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_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 90}
m_LocalScale: {x: 0.013888889, y: 0.013888889, z: 0.013888889}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 111811052}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1536,6 +1537,34 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
currentMap: {fileID: 0}
--- !u!114 &1716277286
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 485a16bcfbf74c7c8f289519efc1979c, type: 3}
m_Name:
m_EditorClassIdentifier:
tileSize: 32
--- !u!114 &1716277287
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 74ab37462cef4f6d99b759fd094b1d6c, type: 3}
m_Name:
m_EditorClassIdentifier:
slotPrefab: {fileID: 1662876271322988295, guid: dd5bd23829f2633488e8d890f7503af0, type: 3}
itemPrefab: {fileID: 6548796882194455502, guid: 8097ab5fed74753418c9dd3d602c7b93, type: 3}
hotkeyEntryPrefab: {fileID: 8445508939331188797, guid: 2ea4eece2df353c4796107c0bb9a6225, type: 3}
--- !u!1 &2076652140
GameObject:
m_ObjectHideFlags: 0
@ -1615,10 +1644,72 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2076652140}
m_CullTransparentMesh: 1
--- !u!1001 &4772071642411593056
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.x
value: -4.64
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.y
value: 0.27
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8257118877032255596, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_Name
value: Tile
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 7848130704331449967, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
m_SourcePrefab: {fileID: 100100000, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1716277275}
- {fileID: 672375811}
- {fileID: 111811052}
- {fileID: 1406866842}
- {fileID: 4772071642411593056}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
using UnityEngine;
[CreateAssetMenu(fileName = "Grid", menuName = "Game Data/Map Grid")]
public class Grid : ScriptableObject
{
public Vector2Int size;
private GridSpace[,] _tiles;
// Initialize the grid with the size of the map
public Grid(Vector2Int size)
{
this.size = size;
Initialize(this.size);
}
public void Initialize(Vector2Int gSize)
{
_tiles = new GridSpace[gSize.x, gSize.y];
}
public GridSpace GetTile(int x, int y)
{
return _tiles[x, y];
}
public void SetTile(int x, int y, GridSpace gridSpace)
{
_tiles[x, y] = gridSpace;
}
public void ClearTile(int x, int y)
{
_tiles[x, y] = null;
}
public bool IsTileOccupied(int x, int y)
{
return _tiles[x, y] != null;
}
public bool IsTileOccupiedByInteractableItem(int x, int y)
{
return _tiles[x, y] != null && _tiles[x, y].InteractableItem != null;
}
public bool IsTileOccupiedByCrop(int x, int y)
{
return _tiles[x, y] != null && _tiles[x, y].Crop != null;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f4bf2190d2ab4d24aa1b1a66f0112baf
timeCreated: 1719406090

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
using UnityEngine;
public class GridSpace : ScriptableObject
{
public Crop Crop { get; set; }
public List<GameItem> GameItems { get; set; }
public InteractableItem InteractableItem { get; set; }
public void Initialize(Vector2Int vector2Int)
{
Debug.Log("GridSpace Initialize");
Crop = null;
GameItems = new List<GameItem>();
InteractableItem = null;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 90adf1932cd64f52b021c5c66bcc00fd
timeCreated: 1719406729

View File

@ -1,17 +1,20 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
[CreateAssetMenu(fileName = "Map", menuName = "Game Data/Map")]
public class Map : ScriptableObject
{
public GridManager gridManager; // The grid for this map
public string sceneName; // The name of the scene this map corresponds to
public Vector3 gridPosition;
public Vector2Int gridSize;
public Vector2Int playerStartPosition;
public Grid grid;
public void OnEnable()
// TODO: we will need some sort of default grid rules that we can apply to each map
// to prevent people from planting crops on the road or in the water, stuff like that.
// public GridRules gridRules;
public void Initialize()
{
gridManager.CreateGridForMap(sceneName, gridSize);
grid = CreateInstance<Grid>();
}
}

File diff suppressed because it is too large Load Diff

363
Assets/Prefabs/Tile.prefab Normal file
View File

@ -0,0 +1,363 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5411729226619395558
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 623056105988180336}
- component: {fileID: 2957710771980246572}
m_Layer: 0
m_Name: Crop
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &623056105988180336
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5411729226619395558}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5869475592065529047}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2957710771980246572
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5411729226619395558}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 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: 21300000, guid: 696718efb1b01ee42a1b15ec3485056c, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &7848130704331449967
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2939938164759589604}
- component: {fileID: 650248281035758156}
- component: {fileID: 27764899484920381}
m_Layer: 0
m_Name: Coord
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2939938164759589604
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7848130704331449967}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5869475592065529047}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.348, y: -0.389}
m_SizeDelta: {x: 0.2467, y: 0.1788}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!23 &650248281035758156
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7848130704331449967}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 4725839695304240861, guid: 13cebca996ee5ef4eb2c9561d98bba55, 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!114 &27764899484920381
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7848130704331449967}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, 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_text: 0x1
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 13cebca996ee5ef4eb2c9561d98bba55, type: 2}
m_sharedMaterial: {fileID: 4725839695304240861, guid: 13cebca996ee5ef4eb2c9561d98bba55, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 2
m_fontSizeBase: 2
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 0
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
_SortingLayer: 0
_SortingLayerID: 0
_SortingOrder: 0
m_hasFontAssetChanged: 0
m_renderer: {fileID: 650248281035758156}
m_maskType: 0
--- !u!1 &8257118877032255596
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5869475592065529047}
- component: {fileID: 5320458187769795758}
- component: {fileID: 1247668486146181009}
m_Layer: 0
m_Name: Tile
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5869475592065529047
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8257118877032255596}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.499, y: -2.499, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 623056105988180336}
- {fileID: 2939938164759589604}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &5320458187769795758
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8257118877032255596}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 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: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 0.11372549}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &1247668486146181009
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8257118877032255596}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 343ab8060b8d4ae6a6f1d9d92ab768a5, type: 3}
m_Name:
m_EditorClassIdentifier:
x: 0
y: 0
isOccupied: 0
isOccupiedByCrop: 0
isOccupiedByInteractableItem: 0
gridSpace: {fileID: 0}
CoordinatesText: {fileID: 27764899484920381}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3d1ff4c5c44ca15439fa1db9c5214989
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

59090
Assets/Prefabs/UICanvas.prefab Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 39759b252d2a3b14bac95b998153b10c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -217,7 +217,6 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2076652141}
- {fileID: 1716277275}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -261,7 +260,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 195, y: -100}
m_AnchoredPosition: {x: -170.39996, y: -98.40002}
m_SizeDelta: {x: 193.02, y: 48.01}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &539028779
@ -394,7 +393,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 195, y: -26}
m_AnchoredPosition: {x: -170.4, y: -24.400017}
m_SizeDelta: {x: 193.02, y: 48.01}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &638113162
@ -796,7 +795,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -10, y: -50.995}
m_AnchoredPosition: {x: -28, y: 44}
m_SizeDelta: {x: 475.22, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &762579829
@ -932,7 +931,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 195, y: -179}
m_AnchoredPosition: {x: -170.39996, y: -177.40002}
m_SizeDelta: {x: 193.02, y: 48.01}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &804445075
@ -1375,15 +1374,18 @@ GameObject:
m_Component:
- component: {fileID: 1716277275}
- component: {fileID: 1716277279}
- component: {fileID: 1716277287}
- component: {fileID: 1716277278}
- component: {fileID: 1716277284}
- component: {fileID: 1716277277}
- component: {fileID: 1716277286}
- component: {fileID: 1716277285}
- component: {fileID: 1716277280}
- component: {fileID: 1716277281}
- component: {fileID: 1716277282}
- component: {fileID: 1716277283}
- component: {fileID: 1716277276}
- component: {fileID: 1716277288}
m_Layer: 5
m_Name: GameManager
m_TagString: Untagged
@ -1398,12 +1400,12 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
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_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 90}
m_LocalScale: {x: 0.013888889, y: 0.013888889, z: 0.013888889}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 111811052}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1536,6 +1538,46 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
currentMap: {fileID: 0}
--- !u!114 &1716277286
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 485a16bcfbf74c7c8f289519efc1979c, type: 3}
m_Name:
m_EditorClassIdentifier:
tileSize: 32
--- !u!114 &1716277287
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 74ab37462cef4f6d99b759fd094b1d6c, type: 3}
m_Name:
m_EditorClassIdentifier:
slotPrefab: {fileID: 1662876271322988295, guid: dd5bd23829f2633488e8d890f7503af0, type: 3}
itemPrefab: {fileID: 6548796882194455502, guid: 8097ab5fed74753418c9dd3d602c7b93, type: 3}
hotkeyEntryPrefab: {fileID: 8445508939331188797, guid: 2ea4eece2df353c4796107c0bb9a6225, type: 3}
--- !u!114 &1716277288
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716277274}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 70e66f233cd34460b23717871895ac59, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2076652140
GameObject:
m_ObjectHideFlags: 0
@ -1615,10 +1657,72 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2076652140}
m_CullTransparentMesh: 1
--- !u!1001 &4772071642411593056
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.x
value: -4.64
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.y
value: 0.27
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5869475592065529047, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8257118877032255596, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
propertyPath: m_Name
value: Tile
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 7848130704331449967, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
m_SourcePrefab: {fileID: 100100000, guid: 3d1ff4c5c44ca15439fa1db9c5214989, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1716277275}
- {fileID: 672375811}
- {fileID: 111811052}
- {fileID: 1406866842}
- {fileID: 4772071642411593056}

View File

@ -4,7 +4,6 @@ using UnityEngine.UI;
public class ItemComponent : MonoBehaviour
{
public PrefabManager prefabManager = PrefabManager.Instance;
public ItemHandler itemHandler;
public GameItem item;
@ -14,7 +13,6 @@ public class ItemComponent : MonoBehaviour
private void Awake()
{
prefabManager = PrefabManager.Instance;
nameText = transform.Find("ItemName").GetComponent<TMP_Text>();
if (nameText == null) Debug.LogError("ItemName not found");
quantityText = transform.Find("qty").GetComponent<Text>();

View File

@ -8,15 +8,12 @@ public class SlotComponent : MonoBehaviour
{
public int SlotId;
public Slot.SlotType SlotType;
private readonly PrefabManager prefabManager = PrefabManager.Instance;
private ItemComponent itemComponent;
protected GameObject itemPrefab;
protected PlayerManager playerManager;
protected SlotHandler slotHandler;
private void Awake()
{
playerManager = GameObject.Find("PlayerManager").GetComponent<PlayerManager>();
// PrintHierarchy(gameObject);
slotHandler = gameObject.AddComponent<SlotHandler>();
@ -72,7 +69,7 @@ public class SlotComponent : MonoBehaviour
return;
}
playerManager.SwapItems(draggedSlot.SlotType, draggedSlot.SlotId, SlotType, SlotId);
PlayerManager.Instance.SwapItems(draggedSlot.SlotType, draggedSlot.SlotId, SlotType, SlotId);
var tempItem = destinationSlot;
@ -94,7 +91,7 @@ public class SlotComponent : MonoBehaviour
if (itemPrefab == null)
// Debug.LogError("ItemPrefab not set");
// return;
itemPrefab = prefabManager.GetItemPrefab();
itemPrefab = PrefabManager.Instance.GetItemPrefab();
var newItemInstance = Instantiate(itemPrefab, transform);
itemComponent = newItemInstance.GetComponent<ItemComponent>();
@ -174,7 +171,7 @@ public class SlotComponent : MonoBehaviour
public bool IsAllowedItemTypes(Slot.SlotType slotType, int slotId, GameItem.ItemType type)
{
var slot = playerManager.GetSlot(slotType, slotId);
var slot = PlayerManager.Instance.GetSlot(slotType, slotId);
return slot.IsAllowedItemTypes(type);
}
@ -208,6 +205,11 @@ public class SlotComponent : MonoBehaviour
public void OnSlotClick()
{
ToolbarUIController.Instance.toolbarManager.SetActiveSlot(SlotId);
ToolbarManager.Instance.SetActiveSlot(SlotId);
}
public void SetSlotType(Slot.SlotType type)
{
SlotType = type;
}
}

View File

@ -0,0 +1,108 @@
using TMPro;
using UnityEngine;
public class TileComponent : MonoBehaviour
{
public int x;
public int y;
public bool isOccupied;
public bool isOccupiedByCrop;
public bool isOccupiedByInteractableItem;
public GridSpace gridSpace;
public TMP_Text coordinatesText;
// Start is called before the first frame update
private void Start()
{
}
public void SetTile(int x, int y)
{
this.x = x;
this.y = y;
}
public void SetOccupied(bool isOccupied)
{
this.isOccupied = isOccupied;
}
public void SetCoordinatesText()
{
coordinatesText.text = x + "x" + y;
}
public void SetOccupiedByCrop(bool isOccupiedByCrop)
{
this.isOccupiedByCrop = isOccupiedByCrop;
}
public void SetOccupiedByInteractableItem(bool isOccupiedByInteractableItem)
{
this.isOccupiedByInteractableItem = isOccupiedByInteractableItem;
}
public void Initialize(GridSpace gSpace)
{
gridSpace = gSpace;
// check if tile is occupied by crop or interactable item
isOccupied = gridSpace != null;
isOccupiedByCrop = gridSpace != null && gridSpace.Crop != null;
isOccupiedByInteractableItem = gridSpace != null && gridSpace.InteractableItem != null;
SetTile(x, y);
SetCoordinatesText();
DrawTileBorder();
}
private void Debug()
{
// add black border around tile and white border around tile
// if tile is occupied by crop or interactable item
if (isOccupied)
{
// add black border around tile
// if tile is occupied by crop
if (isOccupiedByCrop)
{
// add white border around tile
}
// if tile is occupied by interactable item
if (isOccupiedByInteractableItem)
{
// add white border around tile
}
}
}
private void DrawTileBorder()
{
// Create a new GameObject for the border
var border = new GameObject("Border");
// Add a LineRenderer component to the border
var lineRenderer = border.AddComponent<LineRenderer>();
// Set the material of the LineRenderer to the gridMaterial
// lineRenderer.material = gridMaterial;
// Set the positions of the LineRenderer to form a square around the tile
lineRenderer.positionCount = 5;
lineRenderer.SetPositions(new Vector3[]
{
new(transform.position.x, transform.position.y, 0),
new(transform.position.x + GridManager.Instance.tileSize, transform.position.y, 0),
new(transform.position.x + GridManager.Instance.tileSize,
transform.position.y + GridManager.Instance.tileSize, 0),
new(transform.position.x, transform.position.y + GridManager.Instance.tileSize, 0),
new(transform.position.x, transform.position.y, 0)
});
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 343ab8060b8d4ae6a6f1d9d92ab768a5
timeCreated: 1719407755

View File

@ -6,8 +6,6 @@ using UnityEngine;
public class BoxUIController : MonoBehaviour
{
public Transform itemParent;
public BoxManager boxManager;
public PrefabManager prefabManager;
private readonly Dictionary<int, GameObject> _slots = new();
@ -20,18 +18,18 @@ public class BoxUIController : MonoBehaviour
return;
}
boxManager.OnActiveBoxChanged += UpdateUI;
BoxManager.Instance.OnActiveBoxChanged += UpdateUI;
// Delete existing children if any.
foreach (Transform child in itemParent) Destroy(child.gameObject);
if (boxManager.ActiveBox == null)
if (BoxManager.Instance.ActiveBox == null)
return;
if (boxManager.ActiveBox.Slots.Count == 0)
boxManager.Initialize();
if (BoxManager.Instance.ActiveBox.Slots.Count == 0)
BoxManager.Instance.Initialize();
UpdateUI(boxManager.ActiveBox);
UpdateUI(BoxManager.Instance.ActiveBox);
Debug.Log("Finished adding items to toolbar slots");
}
@ -50,7 +48,7 @@ public class BoxUIController : MonoBehaviour
foreach (Transform child in itemParent) Destroy(child.gameObject);
// Get values from inventory and redraw the inventory slots based on that.
var slotPrefab = prefabManager.GetSlotPrefab();
var slotPrefab = PrefabManager.Instance.GetSlotPrefab();
// var itemPrefab = prefabManager.GetItemPrefab();

View File

@ -7,8 +7,6 @@ using UnityEngine;
public class EquipmentUIController : MonoBehaviour
{
public Transform itemParent;
public EquipmentManager equipmentManager;
public PrefabManager prefabManager;
private readonly Dictionary<int, GameObject> _slots = new();
@ -24,14 +22,14 @@ public class EquipmentUIController : MonoBehaviour
// Delete existing children if any.
foreach (Transform child in itemParent) Destroy(child.gameObject);
if (equipmentManager.Slots.Count == 0)
equipmentManager.Initialize(PlayerManager.Instance.playerData);
if (EquipmentManager.Instance.Slots.Count == 0)
EquipmentManager.Instance.Initialize(PlayerManager.Instance.playerData);
var slotPrefab = prefabManager.GetSlotPrefab();
var slotPrefab = PrefabManager.Instance.GetSlotPrefab();
// var itemPrefab = prefabManager.GetItemPrefab();
foreach (var slot in equipmentManager.Slots)
foreach (var slot in EquipmentManager.Instance.Slots)
{
// Draw slots to screen
var slotDisplay = Instantiate(slotPrefab, itemParent);

View File

@ -10,9 +10,7 @@ public class HotkeyUIController : MonoBehaviour
public static HotkeyUIController Instance;
public GameObject hotkeyEntryPrefab; // Assign the HotkeyEntry prefab
public Transform hotkeyListContainer; // Assign the Content transform of ScrollView
public HotkeyManager hotkeyManager;
private readonly Dictionary<string, GameObject> hotkeyEntries = new();
@ -48,11 +46,13 @@ public class HotkeyUIController : MonoBehaviour
public void PopulateHotkeyList()
{
Debug.Log("Getting all hot keys");
var hotkeys = hotkeyManager.GetAllHotkeys();
var hotkeys = HotkeyManager.Instance.GetAllHotkeys();
Debug.Log("Clearing Children");
ClearChildren(hotkeyListContainer);
var hotkeyEntryPrefab = PrefabManager.Instance.GetHotkeyEntryPrefab();
foreach (var hotkey in hotkeys)
{

View File

@ -7,8 +7,6 @@ using UnityEngine;
public class InventoryUIController : MonoBehaviour
{
public Transform itemParent;
public InventoryManager inventoryManager;
public PrefabManager prefabManager;
private readonly Dictionary<int, GameObject> _slots = new();
@ -24,14 +22,14 @@ public class InventoryUIController : MonoBehaviour
// Delete existing children if any.
foreach (Transform child in itemParent) Destroy(child.gameObject);
if (inventoryManager.Slots.Count == 0)
inventoryManager.Initialize(PlayerManager.Instance.playerData);
if (InventoryManager.Instance.Slots.Count == 0)
InventoryManager.Instance.Initialize(PlayerManager.Instance.playerData);
var slotPrefab = prefabManager.GetSlotPrefab();
var itemPrefab = prefabManager.GetItemPrefab();
var slotPrefab = PrefabManager.Instance.GetSlotPrefab();
var itemPrefab = PrefabManager.Instance.GetItemPrefab();
foreach (var inventorySlot in inventoryManager.Slots)
foreach (var inventorySlot in InventoryManager.Instance.Slots)
{
// Draw slots to screen
var slotDisplay = Instantiate(slotPrefab, itemParent);

View File

@ -9,8 +9,6 @@ public class ToolbarUIController : MonoBehaviour
{
public static ToolbarUIController Instance;
public Transform itemParent;
public ToolbarManager toolbarManager;
public PrefabManager prefabManager;
private readonly Dictionary<int, SlotComponent> _slots = new();
@ -36,10 +34,10 @@ public class ToolbarUIController : MonoBehaviour
// Delete existing children if any.
foreach (Transform child in itemParent) Destroy(child.gameObject);
if (toolbarManager.Slots.Count == 0)
toolbarManager.Initialize(PlayerManager.Instance.playerData);
if (ToolbarManager.Instance.Slots.Count == 0)
ToolbarManager.Instance.Initialize(PlayerManager.Instance.playerData);
toolbarManager.OnActiveSlotChanged += UpdateActiveSlot;
ToolbarManager.Instance.OnActiveSlotChanged += UpdateActiveSlot;
var updateUI = UpdateUI();
@ -67,7 +65,7 @@ public class ToolbarUIController : MonoBehaviour
}
// set active slot to active
var activeSlot = toolbarManager.ActiveSlot.slotId;
var activeSlot = ToolbarManager.Instance.ActiveSlot.slotId;
var activeSlotComponent = _slots[activeSlot];
activeSlotComponent.SetSlotActive(true);
@ -84,7 +82,8 @@ public class ToolbarUIController : MonoBehaviour
public void OnSlotClicked(int slotId)
{
toolbarManager.SetActiveSlot(slotId);
ToolbarManager.Instance.SetActiveSlot(slotId);
Debug.Log("Slot clicked: " + slotId + " / Set Active");
UpdateActiveSlot();
}
@ -99,10 +98,10 @@ public class ToolbarUIController : MonoBehaviour
yield return null;
// Get values from inventory and redraw the inventory slots based on that.
var slotPrefab = prefabManager.GetSlotPrefab();
var slotPrefab = PrefabManager.Instance.GetSlotPrefab();
foreach (var toolbarSlot in toolbarManager.Slots)
foreach (var toolbarSlot in ToolbarManager.Instance.Slots)
{
// Draw slots to screen
var slotDisplay = Instantiate(slotPrefab, itemParent);
@ -112,7 +111,6 @@ public class ToolbarUIController : MonoBehaviour
var i = toolbarSlot.Key;
var slotComponent = slotDisplay.GetComponent<SlotComponent>();
var slotHandler = slotDisplay.GetComponent<SlotHandler>();
slotHandler.OnSlotClicked.AddListener(() => OnSlotClicked(i));
Debug.Log("Added slot handler to slot: " + i);
@ -120,6 +118,9 @@ public class ToolbarUIController : MonoBehaviour
// Add prefab to slot
slotComponent.SetSlotDetails(toolbarSlot.Value);
slotComponent.SetSlotActive(false);
slotComponent.SetSlotType(Slot.SlotType.Toolbar);
slotComponent.SetSlotId(i);
_slots.Add(i, slotComponent);
}

View File

@ -24,7 +24,7 @@ public class ItemHandler : MonoBehaviour, IPointerDownHandler, IBeginDragHandler
if (_canvasGroup == null) _canvasGroup = gameObject.AddComponent<CanvasGroup>();
if (canvas == null) canvas = GameObject.Find("UICanvas").GetComponent<Canvas>();
_dragLayerCanvas = GameObject.Find("DragLayerCanvas").GetComponent<Canvas>();
// _dragLayerCanvas = GameObject.Find("DragLayerCanvas").GetComponent<Canvas>();
}

View File

@ -2,21 +2,20 @@
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
public class SlotHandler : MonoBehaviour, IDropHandler, IPointerClickHandler
public class SlotHandler : MonoBehaviour, IDropHandler, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler
{
public PlayerManager playerManager;
[FormerlySerializedAs("onSlotClicked")]
public UnityEvent OnSlotClicked = new();
private bool _isPointerDown;
private float _pointerDownTimer;
private SlotComponent _slotComponent;
private void Awake()
{
playerManager = GameObject.Find("PlayerManager").GetComponent<PlayerManager>();
}
private void Start()
@ -25,6 +24,12 @@ public class SlotHandler : MonoBehaviour, IDropHandler, IPointerClickHandler
OnSlotClicked = new UnityEvent();
}
public void Update()
{
if (_isPointerDown) _pointerDownTimer += Time.deltaTime;
}
public void OnDrop(PointerEventData eventData)
{
Debug.Log("Dropped on internal slot: " + _slotComponent.GetSlotId());
@ -33,7 +38,8 @@ public class SlotHandler : MonoBehaviour, IDropHandler, IPointerClickHandler
var sourceSlot = eventData.pointerDrag.GetComponentInParent<SlotComponent>();
var sourceSlotItem = sourceSlot.GetItemComponent();
var destinationSlotData = playerManager.GetSlot(_slotComponent.GetSlotType(), _slotComponent.GetSlotId());
var destinationSlotData =
PlayerManager.Instance.GetSlot(_slotComponent.GetSlotType(), _slotComponent.GetSlotId());
var destinationItem = _slotComponent.GetItemComponent();
@ -75,7 +81,8 @@ public class SlotHandler : MonoBehaviour, IDropHandler, IPointerClickHandler
// dragged To (this)
playerManager.SwapItems(_slotComponent.GetSlotType(), _slotComponent.GetSlotId(), sourceSlot.GetSlotType(),
PlayerManager.Instance.SwapItems(_slotComponent.GetSlotType(), _slotComponent.GetSlotId(),
sourceSlot.GetSlotType(),
sourceSlot.GetSlotId());
// If the destination slot is empty, assign the dragged item to it
@ -104,16 +111,30 @@ public class SlotHandler : MonoBehaviour, IDropHandler, IPointerClickHandler
}
}
public void OnPointerClick(PointerEventData eventData)
{
TriggerOnClick();
}
public void OnPointerDown(PointerEventData eventData)
{
_isPointerDown = true;
}
public void OnPointerUp(PointerEventData eventData)
{
if (_isPointerDown && _pointerDownTimer < 0.2f) TriggerOnClick();
_isPointerDown = false;
_pointerDownTimer = 0.0f;
}
// onClick handler
public void TriggerOnClick()
{
OnSlotClicked.Invoke();
Debug.Log("Clicked on slot: " + _slotComponent.GetSlotId());
//TODO: pass the click through to allow us to drag the item
}
public void SetSlotComponent(SlotComponent slotComponent)

View File

@ -0,0 +1,21 @@
using UnityEngine;
using UnityEngine.EventSystems;
public class TileHandler : MonoBehaviour, IDropHandler, IPointerClickHandler
{
private void Awake()
{
}
private void Start()
{
}
public void OnDrop(PointerEventData eventData)
{
}
public void OnPointerClick(PointerEventData eventData)
{
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bbcbd421c01e452f9c1b7e83b9a2bfc0
timeCreated: 1719408387

View File

@ -6,42 +6,74 @@ public class InteractableItem
// Properties and methods for interactable items like rocks and trees
}
public class GridSpace
{
public Crop Crop { get; set; }
public GameItem GameItem { get; set; }
public InteractableItem InteractableItem { get; set; }
}
public class GridManager : MonoBehaviour
{
public int tileSize = 32;
private readonly Dictionary<string, GridSpace[,]> grids = new();
private readonly Dictionary<string, Grid> _grids = new();
public static GridManager Instance { get; private set; }
private void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
public void CreateGridForMap(string mapName, Vector2Int gridSize)
{
grids[mapName] = new GridSpace[gridSize.x, gridSize.y];
}
public GridSpace[,] GetGridForMap(Map map)
public Grid CreateGridForMap(string mapName, Vector2Int gridSize)
{
if (grids.TryGetValue(map.sceneName, out var grid)) return grid;
_grids[mapName] = ScriptableObject.CreateInstance<Grid>();
_grids[mapName].Initialize(gridSize);
Debug.Log("New Grid created for map: " + mapName);
return _grids[mapName];
}
public Grid GetGridForMap(Map map)
{
if (_grids.TryGetValue(map.sceneName, out var grid)) return grid;
Debug.LogError($"No grid found for map {map.sceneName}");
// create a new grid with default size
CreateGridForMap(map.sceneName, map.gridSize);
return grids[map.sceneName];
return CreateGridForMap(map.sceneName, map.gridSize);
}
public void AssignGridToMap(Map map, Grid grid)
{
// Load the grid for the map
Debug.Log("Loading grid for map: " + map.sceneName);
_grids[map.sceneName] = grid;
}
// Update your other methods to take a mapName parameter and operate on the correct grid
public void LoadGrid(string currentMapSceneName)
{
Debug.Log("Loading grid: " + currentMapSceneName);
if (_grids.TryGetValue(currentMapSceneName, out var grid))
{
Debug.Log("Grid found for map: " + currentMapSceneName);
// Load the grid by looping through the grid's tiles
for (var x = 0; x < grid.size.x; x++)
for (var y = 0; y < grid.size.y; y++)
{
// Load the tile at position (x, y)
Debug.Log("Loading tile at position: " + x + ", " + y);
var tile = ScriptableObject.CreateInstance<GridSpace>();
tile.Initialize(new Vector2Int(x, y));
grid.SetTile(x, y, tile);
}
}
else
{
Debug.LogError("No grid found for map: " + currentMapSceneName);
}
}
}

View File

@ -16,10 +16,15 @@ public class HotkeyManager : MonoBehaviour
{
// Implement singleton pattern
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
private void Update()
{

View File

@ -111,41 +111,40 @@ public class BoxManager : MonoBehaviour, IItemManager<Slot>
public void Initialize()
{
var testBoxCount = 5;
for (var i = 0; i < testBoxCount; i++)
{
var box = ScriptableObject.CreateInstance<Box>();
box.boxId = i;
Boxes[i] = box;
// box created
Debug.Log("Created box: " + i);
// add 30 slots to each box
for (var j = 0; j < 30; j++)
{
var slot = ScriptableObject.CreateInstance<Slot>();
Debug.LogWarning("Added slots to box: " + j + " / 30 slots added");
slot.slotId = j;
slot.slotType = Slot.SlotType.Box;
slot.item = null;
box.AddSlot(slot);
}
SetActiveBox(i);
// add random inventory to box
for (var j = 0; j < 10; j++)
{
var item = GameItemManager.Instance.gameItems[
Random.Range(0, GameItemManager.Instance.gameItems.Count - 1)];
box.AddItemToOpenSlot(item);
}
}
// var testBoxCount = 5;
//
// for (var i = 0; i < testBoxCount; i++)
// {
// var box = ScriptableObject.CreateInstance<Box>();
// box.boxId = i;
// Boxes[i] = box;
//
// // box created
// Debug.Log("Created box: " + i);
//
// // add 30 slots to each box
// for (var j = 0; j < 30; j++)
// {
// var slot = ScriptableObject.CreateInstance<Slot>();
// Debug.LogWarning("Added slots to box: " + j + " / 30 slots added");
// slot.slotId = j;
// slot.slotType = Slot.SlotType.Box;
// slot.item = null;
// box.AddSlot(slot);
// }
//
//
// SetActiveBox(i);
// // add random inventory to box
// for (var j = 0; j < 10; j++)
// {
// var item = GameItemManager.Instance.gameItems[
// Random.Range(0, GameItemManager.Instance.gameItems.Count - 1)];
//
//
// box.AddItemToOpenSlot(item);
// }
// }
Debug.Log("Completed Initialized items in BoxManager");
}

View File

@ -5,7 +5,7 @@ using UnityEngine.SceneManagement;
public class MapManager : MonoBehaviour
{
public Map currentMap;
public Dictionary<string, Map> maps;
private Dictionary<string, Map> _maps;
public static MapManager Instance { get; private set; }
private void Awake()
@ -24,33 +24,50 @@ public class MapManager : MonoBehaviour
public void LoadMap(Map newMap)
{
Debug.Log("Loading map: " + newMap.name);
// Unload the current map, if any
if (currentMap != null) UnloadMap(currentMap);
// Load the new map
currentMap = newMap;
// load grid
var grid = GetGridForMap(currentMap);
GridManager.Instance.AssignGridToMap(currentMap, grid);
GridManager.Instance.LoadGrid(currentMap.sceneName);
SceneManager.LoadScene(currentMap.sceneName);
}
public Grid GetGridForMap(Map map)
{
// Get the grid for the map
Debug.Log("Getting grid for map: " + map.name);
return GridManager.Instance.GetGridForMap(map);
}
public Grid GetGridForCurrentMap()
{
// Get the grid for the current map
return GridManager.Instance.GetGridForMap(currentMap);
}
public void UnloadMap(Map map)
{
// Clean up the map (e.g., destroy all items and crops)
// map.Clear();
// Destroy(map);
Debug.Log("Unloading map: " + map.name);
Debug.Log("TODO: Unloading map: " + map.name);
}
public void AddMap(Map map)
{
if (maps == null) maps = new Dictionary<string, Map>();
if (_maps == null) _maps = new Dictionary<string, Map>();
maps.Add(map.name, map);
_maps.Add(map.name, map);
}
public void GetMap(string mapName)
{
Debug.Log("Getting map: " + mapName);
if (maps.TryGetValue(mapName, out var map))
if (_maps.TryGetValue(mapName, out var map))
LoadMap(map);
else
Debug.LogWarning("Map not found: " + mapName);