diff --git a/Assets/GridInfo.cs b/Assets/GridInfo.cs deleted file mode 100644 index cd0c40a..0000000 --- a/Assets/GridInfo.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class GridInfo : MonoBehaviour -{ - public static GridInfo instance; - - public int gridWidth = 20; - public int gridHeight = 20; - public float cellSize = 1f; - - private void Awake() - { - instance = this; - } -} diff --git a/Assets/Objects/PlacedObjectsSO/City.asset b/Assets/Objects/PlacedObjectsSO/City.asset deleted file mode 100644 index 6d30f5a..0000000 --- a/Assets/Objects/PlacedObjectsSO/City.asset +++ /dev/null @@ -1,20 +0,0 @@ -%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: ed4c766e9f0dd454da548c672fa99b65, type: 3} - m_Name: City - m_EditorClassIdentifier: - nameString: City - prefab: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - width: 1 - height: 1 - isWalkable: 1 - iconSprite: {fileID: 0} diff --git a/Assets/Objects/PlacedObjectsSO/Park.asset b/Assets/Objects/PlacedObjectsSO/Park.asset deleted file mode 100644 index f49d4bd..0000000 --- a/Assets/Objects/PlacedObjectsSO/Park.asset +++ /dev/null @@ -1,20 +0,0 @@ -%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: ed4c766e9f0dd454da548c672fa99b65, type: 3} - m_Name: Park - m_EditorClassIdentifier: - nameString: Park - prefab: {fileID: 6901973132363593861, guid: 354e6cf04a0ac984cabf402ca3339a38, type: 3} - width: 10 - height: 10 - isWalkable: 1 - iconSprite: {fileID: 0} diff --git a/Assets/Objects/PlacedObjectsSO/way_normal.asset b/Assets/Objects/PlacedObjectsSO/Way.asset similarity index 79% rename from Assets/Objects/PlacedObjectsSO/way_normal.asset rename to Assets/Objects/PlacedObjectsSO/Way.asset index f71114b..fc1e6c3 100644 --- a/Assets/Objects/PlacedObjectsSO/way_normal.asset +++ b/Assets/Objects/PlacedObjectsSO/Way.asset @@ -10,11 +10,11 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: ed4c766e9f0dd454da548c672fa99b65, type: 3} - m_Name: way_normal + m_Name: Way m_EditorClassIdentifier: nameString: Way prefab: {fileID: 3420327930372171566, guid: 1b0d9211d89253549b71b121b268c59b, type: 3} - width: 2 - height: 2 + width: 1 + height: 1 isWalkable: 1 - iconSprite: {fileID: 21300000, guid: d569a0c6db8568848a2a9ac7954225b5, type: 3} + iconSprite: {fileID: 0} diff --git a/Assets/Objects/PlacedObjectsSO/Park.asset.meta b/Assets/Objects/PlacedObjectsSO/Way.asset.meta similarity index 79% rename from Assets/Objects/PlacedObjectsSO/Park.asset.meta rename to Assets/Objects/PlacedObjectsSO/Way.asset.meta index c297197..cba6eb5 100644 --- a/Assets/Objects/PlacedObjectsSO/Park.asset.meta +++ b/Assets/Objects/PlacedObjectsSO/Way.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e48f49821f578f14a9e93af007f9f1b5 +guid: 7a1d078e2a36e9f498a39c535ced6803 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/Objects/Prefabs/House.prefab b/Assets/Objects/Prefabs/House.prefab index 0e824e8..7e192b8 100644 --- a/Assets/Objects/Prefabs/House.prefab +++ b/Assets/Objects/Prefabs/House.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 8483988689672967185} - component: {fileID: 8483988689672967184} - component: {fileID: 8483988689672967183} - - component: {fileID: -1315096407495752853} m_Layer: 0 m_Name: House m_TagString: Untagged @@ -100,16 +99,3 @@ MonoBehaviour: m_EditorClassIdentifier: space: 1 persons: [] - city: {fileID: 0} ---- !u!114 &-1315096407495752853 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8483988689672967182} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 56fadc4f2b895ad46bda623c68601c7e, type: 3} - m_Name: - m_EditorClassIdentifier: diff --git a/Assets/Objects/Prefabs/way_normal.prefab b/Assets/Objects/Prefabs/Way.prefab similarity index 93% rename from Assets/Objects/Prefabs/way_normal.prefab rename to Assets/Objects/Prefabs/Way.prefab index 5579bb7..97bf9c9 100644 --- a/Assets/Objects/Prefabs/way_normal.prefab +++ b/Assets/Objects/Prefabs/Way.prefab @@ -10,9 +10,9 @@ GameObject: m_Component: - component: {fileID: 3420327930372171566} - component: {fileID: 3420327930372171567} - - component: {fileID: 7845977379617268391} + - component: {fileID: 5788513041949726059} m_Layer: 0 - m_Name: way_normal + m_Name: Way m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -85,7 +85,7 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!114 &7845977379617268391 +--- !u!114 &5788513041949726059 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -94,6 +94,6 @@ MonoBehaviour: m_GameObject: {fileID: 3420327930372171564} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 56fadc4f2b895ad46bda623c68601c7e, type: 3} + m_Script: {fileID: 11500000, guid: 5b31ffe74c8ae354abc084445ecb77b6, type: 3} m_Name: m_EditorClassIdentifier: diff --git a/Assets/Objects/Prefabs/way_normal.prefab.meta b/Assets/Objects/Prefabs/Way.prefab.meta similarity index 100% rename from Assets/Objects/Prefabs/way_normal.prefab.meta rename to Assets/Objects/Prefabs/Way.prefab.meta diff --git a/Assets/Objects/Prefabs/Workplace.prefab b/Assets/Objects/Prefabs/Workplace.prefab index a80b093..2538c23 100644 --- a/Assets/Objects/Prefabs/Workplace.prefab +++ b/Assets/Objects/Prefabs/Workplace.prefab @@ -27,8 +27,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2879071748697521144} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 16.49, y: -7.48, z: -0} - m_LocalScale: {x: 4, y: 4, z: 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: 0} @@ -75,7 +75,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 2 - m_Sprite: {fileID: -5177388603050735206, guid: 8884154dfe85442a3a3578be807dbcdf, type: 3} + m_Sprite: {fileID: 21300000, guid: d20366dbe5863874cb8337292e5afbaa, type: 3} m_Color: {r: 0.40392157, g: 0.25729215, b: 0.2509804, a: 1} m_FlipX: 0 m_FlipY: 0 @@ -98,11 +98,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2b0d700ec6a861f499e0c4bf7220bb68, type: 3} m_Name: m_EditorClassIdentifier: - space: 1 + space: 5 salary: 4.5 workers: [] activeWorkers: [] - city: {fileID: 0} --- !u!61 &175939583700583309 BoxCollider2D: m_ObjectHideFlags: 0 @@ -118,9 +117,9 @@ BoxCollider2D: m_UsedByComposite: 0 m_Offset: {x: 0, y: 0} m_SpriteTilingProperty: - border: {x: 0.25, y: 0.25, z: 0.25, w: 0.25} - pivot: {x: 0.5, y: 0.5} - oldSize: {x: 1, y: 1} + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 4, y: 4} newSize: {x: 1, y: 1} adaptiveTilingThreshold: 0.5 drawMode: 0 diff --git a/Assets/PersonManager.cs b/Assets/PersonManager.cs deleted file mode 100644 index 851b9c2..0000000 --- a/Assets/PersonManager.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class PersonManager : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Prefabs/GameManager.prefab b/Assets/Prefabs/GameManager.prefab index c468f3f..16f0a23 100644 --- a/Assets/Prefabs/GameManager.prefab +++ b/Assets/Prefabs/GameManager.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 6060181944501674506} - component: {fileID: 6060181944501674505} - component: {fileID: 6060181944501674507} + - component: {fileID: 4701203439639828366} m_Layer: 0 m_Name: GameManager m_TagString: Untagged @@ -61,3 +62,22 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: money: 0 +--- !u!114 &4701203439639828366 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6060181944501674504} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1da1a268031cfd742a614a4d319ddc32, type: 3} + m_Name: + m_EditorClassIdentifier: + cityName: Bremerhaven + citizens: [] + houses: [] + companies: [] + workplaces: [] + stores: [] + freeTimeObjects: [] diff --git a/Assets/Scenes/GridScene.unity b/Assets/Scenes/GridScene.unity index 5e16a46..e270797 100644 --- a/Assets/Scenes/GridScene.unity +++ b/Assets/Scenes/GridScene.unity @@ -123,17 +123,6 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!114 &125457568 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 3180108334736411172, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - m_PrefabInstance: {fileID: 1575739025} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1da1a268031cfd742a614a4d319ddc32, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &334969309 PrefabInstance: m_ObjectHideFlags: 0 @@ -148,11 +137,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7365408954618877744, guid: bba65a6ddff46b740a482e11b8970dae, type: 3} propertyPath: m_LocalPosition.x - value: 0 + value: 41 objectReference: {fileID: 0} - target: {fileID: 7365408954618877744, guid: bba65a6ddff46b740a482e11b8970dae, type: 3} propertyPath: m_LocalPosition.y - value: 0 + value: 10 objectReference: {fileID: 0} - target: {fileID: 7365408954618877744, guid: bba65a6ddff46b740a482e11b8970dae, type: 3} propertyPath: m_LocalPosition.z @@ -209,81 +198,6 @@ PrefabInstance: m_RemovedComponents: [] m_AddedGameObjects: [] m_SourcePrefab: {fileID: 100100000, guid: bba65a6ddff46b740a482e11b8970dae, type: 3} ---- !u!1001 &415185481 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 2 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 3364287627891004760, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_Enabled - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659705, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: city - value: - objectReference: {fileID: 125457568} - - target: {fileID: 3391280458837659705, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_Enabled - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659708, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_Name - value: Person - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659708, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_RootOrder - value: 5 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalPosition.x - value: 3.739 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalPosition.y - value: 3.299 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3391280458837659710, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_AddedGameObjects: [] - m_SourcePrefab: {fileID: 100100000, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} --- !u!1 &452174896 GameObject: m_ObjectHideFlags: 0 @@ -349,7 +263,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &662991562 MonoBehaviour: @@ -365,17 +279,15 @@ MonoBehaviour: m_EditorClassIdentifier: slotPrefab: {fileID: 8958236829534084260, guid: 3ddcd226e7321f04c96501bbb8023ef2, type: 3} placedObjectTypeSOList: - - {fileID: 11400000, guid: b08e32832db84ca489b3dd705df7eff7, type: 2} - {fileID: 11400000, guid: e13569291cbf1f2499f982d25784b5b9, type: 2} - - {fileID: 11400000, guid: e48f49821f578f14a9e93af007f9f1b5, type: 2} - - {fileID: 11400000, guid: 71956a4ddccdfb34fb39b1a383dd126e, type: 2} + - {fileID: 11400000, guid: 7a1d078e2a36e9f498a39c535ced6803, type: 2} - {fileID: 11400000, guid: a3af05d8c76685a46a14a02dd92103ec, type: 2} --- !u!1 &774998876 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6060181944501674504, guid: 40a19dcc5827c5e4cbf618d6b8c883e6, type: 3} m_PrefabInstance: {fileID: 1762203019} m_PrefabAsset: {fileID: 0} ---- !u!114 &774998880 +--- !u!114 &774998886 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -387,6 +299,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a66523eed61c5b44af39762a8d6e476, type: 3} m_Name: m_EditorClassIdentifier: + personPrefab: {fileID: 3391280458837659708, guid: 4b478a82c8aed4e4e9f09083bf6afa01, type: 3} --- !u!1 &1438861047 GameObject: m_ObjectHideFlags: 0 @@ -479,7 +392,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 8 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} --- !u!1 &1522634444 GameObject: @@ -512,6 +425,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a9e8b2a885476754e9652c90137f91bc, type: 3} m_Name: m_EditorClassIdentifier: + gridWidth: 200 + gridHeight: 200 + cellSize: 1 --- !u!4 &1522634446 Transform: m_ObjectHideFlags: 0 @@ -551,68 +467,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a9ff0826ad15d5c43859748285744c87, type: 3} m_Name: m_EditorClassIdentifier: - gridWidth: 100 - gridHeight: 100 + gridWidth: 30 + gridHeight: 30 cellSize: 1 ---- !u!1001 &1575739025 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 2 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_RootOrder - value: 6 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalPosition.x - value: 94.27026 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalPosition.y - value: 344.51196 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411173, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3180108334736411175, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} - propertyPath: m_Name - value: City - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_AddedGameObjects: [] - m_SourcePrefab: {fileID: 100100000, guid: a0f5cce80f851794aa28b176e811a46e, type: 3} --- !u!1001 &1762203019 PrefabInstance: m_ObjectHideFlags: 0 @@ -672,50 +529,6 @@ PrefabInstance: m_RemovedComponents: [] m_AddedGameObjects: [] m_SourcePrefab: {fileID: 100100000, guid: 40a19dcc5827c5e4cbf618d6b8c883e6, type: 3} ---- !u!1 &1988103521 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1988103523} - - component: {fileID: 1988103522} - m_Layer: 0 - m_Name: test - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1988103522 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1988103521} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4a9e1a4cbcd629e43960027a99f45196, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!4 &1988103523 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1988103521} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 26.93912, y: 11.586942, z: -0.30080035} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 4 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!224 &1870008290347302415 RectTransform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/City.cs b/Assets/Scripts/City.cs index fe107ad..9819f6e 100644 --- a/Assets/Scripts/City.cs +++ b/Assets/Scripts/City.cs @@ -9,7 +9,7 @@ public class City : MonoBehaviour string cityName; - [SerializeField] List citizens = new List(); + [SerializeField] List persons = new List(); [SerializeField] List houses = new List(); [SerializeField] List companies = new List(); [SerializeField] List workplaces = new List(); @@ -21,20 +21,20 @@ public class City : MonoBehaviour public List GetHouses() => houses; public List GetWorkplaces() => workplaces; - public void AddCitizen(Person citizen) + public void AddPerson(Person citizen) { - if (!citizens.Contains(citizen)) + if (!persons.Contains(citizen)) { - citizens.Add(citizen); + persons.Add(citizen); Debug.Log(citizen.GetFullName() + " joined " + cityName); } } - public void RemoveCitizen(Person citizen) + public void RemovePerson(Person citizen) { - if (citizens.Contains(citizen)) + if (persons.Contains(citizen)) { - citizens.Remove(citizen); + persons.Remove(citizen); Debug.Log(citizen.GetFullName() + " left " + cityName); } } @@ -57,6 +57,36 @@ public class City : MonoBehaviour } } + public House GetAvaiableHouse() + { + List avaiableHouses = new List(); + foreach (House house in houses) + { + if(house.GetAvaiableSpace() > 0) + avaiableHouses.Add(house); + } + + if(avaiableHouses.Count > 0) + { + return avaiableHouses[Random.Range(0, avaiableHouses.Count - 1)]; + } + else + { + return null; + } + + } + + public int GetAvaiableHousingSpace() + { + int space = 0; + foreach(House house in houses) + { + space += house.GetAvaiableSpace(); + } + return space; + } + public void AddCompany(Company company) { if (!companies.Contains(company)) @@ -126,4 +156,23 @@ public class City : MonoBehaviour Debug.Log("workplaces demolished in " + cityName); } } + + public Workplace GetAvaiableWorkplace() + { + List avaiableWorkplaces = new List(); + foreach (Workplace workplace in workplaces) + { + if (workplace.GetAvaiableSpace() > 0) + avaiableWorkplaces.Add(workplace); + } + + if (avaiableWorkplaces.Count > 0) + { + return avaiableWorkplaces[Random.Range(0, avaiableWorkplaces.Count - 1)]; + } + else + { + return null; + } + } } diff --git a/Assets/Scripts/Grid/GridBuildingSystem.cs b/Assets/Scripts/Grid/GridBuildingSystem.cs index f299eab..909125c 100644 --- a/Assets/Scripts/Grid/GridBuildingSystem.cs +++ b/Assets/Scripts/Grid/GridBuildingSystem.cs @@ -8,24 +8,67 @@ public class GridBuildingSystem : MonoBehaviour public static GridBuildingSystem instance; public Grid buildingGrid; + public int gridWidth; + public int gridHeight; + public float cellSize; + PlacedObjectTypeSO selectedPlacedObjectTypeSO; Transform selectedGameObjectTransform; - void Start() + public class GridObject + { + int x, y; + bool isAccessable; + Grid grid; + PlacedObject placedObject; + public GridObject(Grid _grid, int _x, int _y, bool _isAccessable = true) // FOR DEBUG TRUE + { + grid = _grid; + x = _x; + y = _y; + isAccessable = _isAccessable; + } + public void SetPlacedObject(PlacedObject _placedObject) => placedObject = _placedObject; + public PlacedObject GetPlacedObject() => placedObject; + public void ClearPlacedObject() => placedObject = null; + public void SetIsAccessable(bool _isAccessable) => isAccessable = _isAccessable; + public void SwitchIsAccessable() => isAccessable = !isAccessable; + public bool IsAccessable() => isAccessable; + public bool CanBuild() + { + return placedObject == null && isAccessable; + } + } + + + void Awake() { if (instance == null) instance = this; - int gridWidth = GridInfo.instance.gridWidth; - int gridHeight = GridInfo.instance.gridHeight; - float cellSize = GridInfo.instance.cellSize; - buildingGrid = new Grid(gridWidth, gridHeight, cellSize, Vector3.zero, (Grid g, int x, int y) => new GridObject(g, x, y)); } void Update() { - if(selectedGameObjectTransform != null) + UpdateSelectedGameObject(); + + // DEBUG + if (Input.GetKeyDown(KeyCode.U)) + { + buildingGrid.GetGridObject(Camera.main.ScreenToWorldPoint(Input.mousePosition)).SwitchIsAccessable(); + } + + if (Input.GetKeyDown(KeyCode.F)) + { + buildingGrid.GetGridObject(Camera.main.ScreenToWorldPoint(Input.mousePosition)).GetPlacedObject(); + } + + } + + void UpdateSelectedGameObject() + { + if (selectedGameObjectTransform != null) { Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); @@ -33,7 +76,7 @@ public class GridBuildingSystem : MonoBehaviour selectedGameObjectTransform.position = buildingGrid.GetWorldPosition(x, y); - List gridPositionList = selectedPlacedObjectTypeSO.GetGridPositionList(new Vector2Int(x, y), PlacedObjectTypeSO.Dir.Down); + List gridPositionList = selectedPlacedObjectTypeSO.GetGridPositionList(new Vector2Int(x, y)); if (!CanBuild(gridPositionList)) { selectedGameObjectTransform.gameObject.GetComponent().color = Color.red; @@ -46,34 +89,13 @@ public class GridBuildingSystem : MonoBehaviour if (Input.GetMouseButtonDown(0)) { PlaceBuilding(); - }else if (Input.GetMouseButtonDown(1) || Input.GetKeyDown(KeyCode.Escape)) + } + else if (Input.GetMouseButtonDown(1) || Input.GetKeyDown(KeyCode.Escape)) { DeselectBuilding(); } - } - } - - public class GridObject - { - int x, y; - Grid grid; - PlacedObject placedObject; - public GridObject(Grid _grid, int _x, int _y) - { - grid = _grid; - x = _x; - y = _y; - } - public void SetPlacedObject(PlacedObject _placedObject) => placedObject = _placedObject; - public PlacedObject GetPlacedObject() => placedObject; - public void ClearPlacedObject() => placedObject = null; - - public bool CanBuild() - { - return placedObject == null; } } - public void DemolishBuilding(Vector3 position) { GridObject gridObject = buildingGrid.GetGridObject(position); // Camera.main.ScreenToWorldPoint(Input.mousePosition) @@ -114,13 +136,13 @@ public class GridBuildingSystem : MonoBehaviour Vector3 mousePosition = new Vector3(position.x, position.y); buildingGrid.GetXY(mousePosition, out int x, out int y); - List gridPositionList = selectedPlacedObjectTypeSO.GetGridPositionList(new Vector2Int(x, y), PlacedObjectTypeSO.Dir.Down); + List gridPositionList = selectedPlacedObjectTypeSO.GetGridPositionList(new Vector2Int(x, y)); if (CanBuild(gridPositionList)) { - PlacedObject placedObject = PlacedObject.Create(buildingGrid.GetWorldPosition(x, y), new Vector2Int(x, y), PlacedObjectTypeSO.Dir.Down, selectedPlacedObjectTypeSO); + PlacedObject placedObject = PlacedObject.Create(buildingGrid.GetWorldPosition(x, y), new Vector2Int(x, y), selectedPlacedObjectTypeSO); foreach (Vector2Int gridPosition in gridPositionList) { diff --git a/Assets/PathfindingSystem.cs b/Assets/Scripts/Grid/PathfindingSystem.cs similarity index 90% rename from Assets/PathfindingSystem.cs rename to Assets/Scripts/Grid/PathfindingSystem.cs index 9fe7837..c789c17 100644 --- a/Assets/PathfindingSystem.cs +++ b/Assets/Scripts/Grid/PathfindingSystem.cs @@ -6,16 +6,16 @@ public class PathfindingSystem : MonoBehaviour { public static PathfindingSystem instance { get; private set; } public Pathfinding pathfinding; - - // int originX = 0; - // int originY = 0; + + void Start() { instance = this; - int gridWidth = GridInfo.instance.gridWidth; - int gridHeight = GridInfo.instance.gridHeight; - float cellSize = GridInfo.instance.cellSize; + + int gridWidth = GridBuildingSystem.instance.gridWidth; + int gridHeight = GridBuildingSystem.instance.gridHeight; + float cellSize = GridBuildingSystem.instance.cellSize; pathfinding = new Pathfinding(gridWidth, gridHeight, cellSize); } diff --git a/Assets/PathfindingSystem.cs.meta b/Assets/Scripts/Grid/PathfindingSystem.cs.meta similarity index 100% rename from Assets/PathfindingSystem.cs.meta rename to Assets/Scripts/Grid/PathfindingSystem.cs.meta diff --git a/Assets/Scripts/Grid/PlacedObject.cs b/Assets/Scripts/Grid/PlacedObject.cs index d5506e2..886b910 100644 --- a/Assets/Scripts/Grid/PlacedObject.cs +++ b/Assets/Scripts/Grid/PlacedObject.cs @@ -3,16 +3,17 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.Tilemaps; -public class PlacedObject : MonoBehaviour +public abstract class PlacedObject : MonoBehaviour { - public static PlacedObject Create(Vector3 worldPosition, Vector2Int origin, PlacedObjectTypeSO.Dir dir, PlacedObjectTypeSO placedObjectTypeSO) + public static PlacedObject Create(Vector3 worldPosition, Vector2Int origin, PlacedObjectTypeSO placedObjectTypeSO) { Transform placeObjectTransform = Instantiate(placedObjectTypeSO.prefab, worldPosition, Quaternion.identity); PlacedObject placedObject = placeObjectTransform.GetComponent(); placedObject.placedObjectTypeSO = placedObjectTypeSO; placedObject.origin = origin; - placedObject.dir = dir; + + placedObject.OnPlace(); if (placedObjectTypeSO.isWalkable) { @@ -28,11 +29,12 @@ public class PlacedObject : MonoBehaviour PlacedObjectTypeSO placedObjectTypeSO; Vector2Int origin; - PlacedObjectTypeSO.Dir dir; + + public abstract void OnPlace(); public List GetGridPositionList() { - return placedObjectTypeSO.GetGridPositionList(origin, PlacedObjectTypeSO.Dir.Down); + return placedObjectTypeSO.GetGridPositionList(origin); } public void DestroySelf() diff --git a/Assets/Scripts/Grid/PlacedObjectTypeSO.cs b/Assets/Scripts/Grid/PlacedObjectTypeSO.cs index 907e3b1..7ff3763 100644 --- a/Assets/Scripts/Grid/PlacedObjectTypeSO.cs +++ b/Assets/Scripts/Grid/PlacedObjectTypeSO.cs @@ -6,25 +6,6 @@ using UnityEngine; public class PlacedObjectTypeSO : ScriptableObject { - public static Dir GetNextDir(Dir dir) - { - switch (dir) - { - default: - case Dir.Down: return Dir.Left; - case Dir.Left: return Dir.Up; - case Dir.Up: return Dir.Right; - case Dir.Right: return Dir.Down; - } - } - public enum Dir - { - Down, - Left, - Up, - Right, - } - public string nameString; public Transform prefab; //public Transform visual; @@ -33,56 +14,16 @@ public class PlacedObjectTypeSO : ScriptableObject public bool isWalkable = false; public Sprite iconSprite; - public int GetRotationAngle(Dir dir) - { - switch (dir) - { - default: - case Dir.Down: return 0; - case Dir.Left: return 90; - case Dir.Up: return 180; - case Dir.Right: return 270; - } - } - public Vector2Int GetRotationOffset(Dir dir) - { - switch (dir) - { - default: - case Dir.Down: return new Vector2Int(0, 0); - case Dir.Left: return new Vector2Int(0, width); - case Dir.Up: return new Vector2Int(width, height); - case Dir.Right: return new Vector2Int(height, 0); - } - } - - public List GetGridPositionList(Vector2Int offset, Dir dir) + public List GetGridPositionList(Vector2Int offset) { List gridPositionList = new List(); - switch (dir) + for (int x = 0; x < width; x++) { - default: - case Dir.Down: - case Dir.Up: - for (int x = 0; x < width; x++) - { - for (int y = 0; y < height; y++) - { - gridPositionList.Add(offset + new Vector2Int(x, y)); - } - } - break; - case Dir.Left: - case Dir.Right: - for (int x = 0; x < height; x++) - { - for (int y = 0; y < width; y++) - { - gridPositionList.Add(offset + new Vector2Int(x, y)); - } - } - break; + for (int y = 0; y < height; y++) + { + gridPositionList.Add(offset + new Vector2Int(x, y)); + } } return gridPositionList; } diff --git a/Assets/Scripts/Managers/AreaManager.cs b/Assets/Scripts/Managers/AreaManager.cs new file mode 100644 index 0000000..8c867c8 --- /dev/null +++ b/Assets/Scripts/Managers/AreaManager.cs @@ -0,0 +1,64 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class AreaManager : MonoBehaviour +{ + [SerializeField] int areaHeight; + [SerializeField] int areaWidth; + List areaObjects; + [SerializeField] GameObject testPrefab; + void Start() + { + //int gridWidth = GridBuildingSystem.instance.buildingGrid.GetWidth(); + //int gridHeight = GridBuildingSystem.instance.buildingGrid.GetWidth(); + + int areaWidthCount = GridBuildingSystem.instance.buildingGrid.GetWidth() / areaWidth; + int areaHeightCount = GridBuildingSystem.instance.buildingGrid.GetHeight() / areaHeight; + + for(int heightCounter = 0; heightCounter < areaHeightCount; heightCounter++) + { + Debug.Log("---- New Row -----"); + for (int widthCounter = 0; widthCounter < areaWidthCount; widthCounter++) + { + Debug.Log("---- New Area -----"); + + List testGameObjs = new List(); + for (int x = 0; x < areaWidth; x++) + { + for (int y = 0; y < areaHeight; y++) + { + + Debug.Log((x + widthCounter * areaWidth).ToString() + "," + (y + heightCounter * areaHeight).ToString()); + GameObject testObj = Instantiate(testPrefab); + testObj.transform.position = GridBuildingSystem.instance.buildingGrid.GetWorldPosition((x + widthCounter * areaWidth), (y + heightCounter * areaHeight)); + testObj.transform.name = widthCounter + " - " + heightCounter; + testGameObjs.Add(testObj); + } + } + + Color color = Random.ColorHSV(); + foreach (GameObject testObj in testGameObjs) + { + testObj.GetComponent().color = color; + } + + } + } + + + } + + + + + public class AreaObject + { + public int[,] tileArray; + + public AreaObject(int[,] _tileArray) { + tileArray = _tileArray; + } + + } +} diff --git a/Assets/GridInfo.cs.meta b/Assets/Scripts/Managers/AreaManager.cs.meta similarity index 83% rename from Assets/GridInfo.cs.meta rename to Assets/Scripts/Managers/AreaManager.cs.meta index 6df9311..7f11e5a 100644 --- a/Assets/GridInfo.cs.meta +++ b/Assets/Scripts/Managers/AreaManager.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a9ff0826ad15d5c43859748285744c87 +guid: 2be9f8a208335fe43bb797bec633e029 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Managers/PersonManager.cs b/Assets/Scripts/Managers/PersonManager.cs new file mode 100644 index 0000000..1b6e477 --- /dev/null +++ b/Assets/Scripts/Managers/PersonManager.cs @@ -0,0 +1,36 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PersonManager : MonoBehaviour +{ + City city; + [SerializeField] GameObject personPrefab; + void Start() + { + city = GetComponent(); + TimeManager.OnDayUpdate += OnDayUpdate; + } + + void OnDayUpdate() + { + int avaiableSpace = city.GetAvaiableHousingSpace(); + if (avaiableSpace > 5) + { + SpawnPerson(5); + } + else + { + SpawnPerson(avaiableSpace); + } + + } + + public void SpawnPerson(int count = 1) + { + for(int i = 0; i < count; i++) + { + Instantiate(personPrefab); + } + } +} diff --git a/Assets/PersonManager.cs.meta b/Assets/Scripts/Managers/PersonManager.cs.meta similarity index 100% rename from Assets/PersonManager.cs.meta rename to Assets/Scripts/Managers/PersonManager.cs.meta diff --git a/Assets/Scripts/Managers/TimeManager.cs b/Assets/Scripts/Managers/TimeManager.cs index 7a4d13c..934188b 100644 --- a/Assets/Scripts/Managers/TimeManager.cs +++ b/Assets/Scripts/Managers/TimeManager.cs @@ -31,7 +31,7 @@ public class TimeManager : MonoBehaviour int minutesPerInterval = 1; public CultureInfo cultureInfo = new CultureInfo("en-us"); - DateTime dateTime = new DateTime(1, 1, 1, 0, 0, 0); + DateTime dateTime = new DateTime(1, 1, 1, 23, 0, 0); DateTime prevDateTime; float timer; diff --git a/Assets/Scripts/Person/Person.cs b/Assets/Scripts/Person/Person.cs index fca278b..cbcc2c0 100644 --- a/Assets/Scripts/Person/Person.cs +++ b/Assets/Scripts/Person/Person.cs @@ -31,14 +31,151 @@ public class Person : MonoBehaviour System.DateTime goToWorkDateTime; - - void Awake() + + // DEBUG + private void Update() { - + if (Input.GetKeyDown(KeyCode.G)) + { + movement.SetTarget(Camera.main.ScreenToWorldPoint(Input.mousePosition)); + } } + void Start() + { + Register(); + movement = gameObject.GetComponent(); + indicators = gameObject.GetComponent(); + transform.position = house.transform.position; + + TimeManager.OnDayUpdate += DestroyInactive; + TimeManager.OnDayUpdate += CheckWorkplace; + TimeManager.OnDayUpdate += OnDayUpdate; + TimeManager.OnMinuteUpdate += OnMinuteUpdate; + + SetBehaivorDateTimes(); + } + + void Register() + { + // Register To City + city = GameObject.Find("GameManager").GetComponent(); + city.AddPerson(this); + // Register To House + house = city.GetAvaiableHouse(); + if(house != null) + house.AddPerson(this); + // Register To Workplace + workplace = city.GetAvaiableWorkplace(); + if(workplace != null) + workplace.AddWorker(this); + } + + void CheckWorkplace() + { + if (workplace == null) + { + workplace = city.GetAvaiableWorkplace(); + workplace.AddWorker(this); + } + } + void DestroyInactive() + { + // Destroy a person if they do not find a house anymore + if (house == null) + { + if(city != null) + city.RemovePerson(this); + if (workplace != null) + workplace.RemoveWorker(this); + + Destroy(gameObject); + } + } + + + void OnDayUpdate() + { + SetBehaivorDateTimes(); + } + void OnMinuteUpdate() + { + + // Work -> FreeTime -> Sleep + + if (TimeManager.instance.GetDateTime() > goToWorkDateTime.AddHours(12)) // Sleep + { + Sleep(); + } + else if (TimeManager.instance.GetDateTime() > goToWorkDateTime.AddHours(8)) // FreeTime + { + FreeTime(); + } + else if (TimeManager.instance.GetDateTime() > goToWorkDateTime) // Work + { + Work(); + } + } + void FreeTime() + { + if (status == PersonStatus.STORE) + { + if (indicators.GetSupplied() == 1.0f) + { + status = PersonStatus.FREETIME; + } + } + else if (status != PersonStatus.PARK) + { + status = PersonStatus.FREETIME; + } + + if (indicators.GetSupplied() < 0.3f || status == PersonStatus.STORE) + { + status = PersonStatus.STORE; + Debug.Log(city.GetStores().Count - 1); + //movement.SetTarget(city.GetStores()[Random.Range(0, city.GetStores().Count - 1)].transform.position); + } + else if (status != PersonStatus.PARK) + { + status = PersonStatus.PARK;// Check if any Object exsits + //movement.SetTarget(city.GetFreeTimeObjects()[Random.Range(0, city.GetFreeTimeObjects().Count)].transform.position); + } + } + + void Work() + { + status = PersonStatus.WORK; + movement.SetTarget(workplace.transform.position); + } + + void Sleep() + { + status = PersonStatus.SLEEP; + Debug.Log(house.transform.position); + movement.SetTarget(house.transform.position); + } + + void SetBehaivorDateTimes() + { + System.DateTime currentDateTime = TimeManager.instance.GetDateTime(); + goToWorkDateTime = new System.DateTime(currentDateTime.Year, + currentDateTime.Month, + currentDateTime.Day, + Random.Range(4, 9), + Random.Range(0, 59), + currentDateTime.Second); + + } + + + + + + /* void Start () { + city.AddCitizen(this); house.AddPerson(this); workplace.AddWorker(this); @@ -66,7 +203,7 @@ public class Person : MonoBehaviour Debug.Log("House added to " + GetFullName()); } } - }*/ + } movement = GetComponent(); @@ -79,6 +216,8 @@ public class Person : MonoBehaviour Sleep(); } + + void OnDayUpdate() { SetBehaivorDateTimes(); @@ -150,5 +289,5 @@ public class Person : MonoBehaviour Random.Range(0, 59), currentDateTime.Second); - } + }*/ } diff --git a/Assets/Scripts/Person/PersonMovement.cs b/Assets/Scripts/Person/PersonMovement.cs index 2b2b3df..f5be123 100644 --- a/Assets/Scripts/Person/PersonMovement.cs +++ b/Assets/Scripts/Person/PersonMovement.cs @@ -7,7 +7,7 @@ public class PersonMovement : MonoBehaviour { private int currentPathIndex; [SerializeField] private List pathVectorList = new List(); - private const float speed = 40f; + private const float speed = 5f; Rigidbody2D rigidbody; private void Awake() diff --git a/Assets/Objects/PlacedObjectsSO/way_normal.asset.meta b/Assets/Scripts/PlacedObjects.meta similarity index 52% rename from Assets/Objects/PlacedObjectsSO/way_normal.asset.meta rename to Assets/Scripts/PlacedObjects.meta index 82e17c6..ba95f57 100644 --- a/Assets/Objects/PlacedObjectsSO/way_normal.asset.meta +++ b/Assets/Scripts/PlacedObjects.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: b08e32832db84ca489b3dd705df7eff7 -NativeFormatImporter: +guid: 131d1b9c458b14447ae47bfeb1c7680e +folderAsset: yes +DefaultImporter: externalObjects: {} - mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Scripts/Housing/House.cs b/Assets/Scripts/PlacedObjects/House.cs similarity index 86% rename from Assets/Scripts/Housing/House.cs rename to Assets/Scripts/PlacedObjects/House.cs index 48574f4..b41cb16 100644 --- a/Assets/Scripts/Housing/House.cs +++ b/Assets/Scripts/PlacedObjects/House.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class House : MonoBehaviour +public class House : PlacedObject { [Header("House")] [SerializeField] @@ -11,13 +11,13 @@ public class House : MonoBehaviour [SerializeField] List persons = new List(); - [SerializeField] City city; public int GetAvaiableSpace() => space - persons.Count; - void Awake() + public override void OnPlace() { + city = GameObject.Find("GameManager").GetComponent(); city.AddHouse(this); } diff --git a/Assets/Scripts/Housing/House.cs.meta b/Assets/Scripts/PlacedObjects/House.cs.meta similarity index 100% rename from Assets/Scripts/Housing/House.cs.meta rename to Assets/Scripts/PlacedObjects/House.cs.meta diff --git a/Assets/Scripts/PlacedObjects/Way.cs b/Assets/Scripts/PlacedObjects/Way.cs new file mode 100644 index 0000000..466f41e --- /dev/null +++ b/Assets/Scripts/PlacedObjects/Way.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Way : PlacedObject +{ + public override void OnPlace() + { + Debug.Log("Placed Way"); + } + +} diff --git a/Assets/Scripts/PlacedObjects/Way.cs.meta b/Assets/Scripts/PlacedObjects/Way.cs.meta new file mode 100644 index 0000000..b5b3bfb --- /dev/null +++ b/Assets/Scripts/PlacedObjects/Way.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5b31ffe74c8ae354abc084445ecb77b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/BuildingMenu.cs b/Assets/Scripts/UI/BuildingMenu.cs similarity index 100% rename from Assets/BuildingMenu.cs rename to Assets/Scripts/UI/BuildingMenu.cs diff --git a/Assets/BuildingMenu.cs.meta b/Assets/Scripts/UI/BuildingMenu.cs.meta similarity index 100% rename from Assets/BuildingMenu.cs.meta rename to Assets/Scripts/UI/BuildingMenu.cs.meta diff --git a/Assets/BuildingMenuSlot.cs b/Assets/Scripts/UI/BuildingMenuSlot.cs similarity index 100% rename from Assets/BuildingMenuSlot.cs rename to Assets/Scripts/UI/BuildingMenuSlot.cs diff --git a/Assets/BuildingMenuSlot.cs.meta b/Assets/Scripts/UI/BuildingMenuSlot.cs.meta similarity index 100% rename from Assets/BuildingMenuSlot.cs.meta rename to Assets/Scripts/UI/BuildingMenuSlot.cs.meta diff --git a/Assets/Scripts/Work/Workplace.cs b/Assets/Scripts/Work/Workplace.cs index b3c09d1..4cd5f1d 100644 --- a/Assets/Scripts/Work/Workplace.cs +++ b/Assets/Scripts/Work/Workplace.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class Workplace : MonoBehaviour +public class Workplace : PlacedObject { [Header("Workplace")] [SerializeField] int space = 4; @@ -11,22 +11,16 @@ public class Workplace : MonoBehaviour [SerializeField] List workers = new List(); [SerializeField] List activeWorkers = new List(); // Workers which are currently present and working - [SerializeField] Company company; - public void SetCompany(Company _company) => company = _company; + City city; public void AddActiveWorker(Person worker) => activeWorkers.Add(worker); public void RemoveActiveWorker(Person worker) => activeWorkers.Remove(worker); public int GetAvaiableSpace() => space - workers.Count; - void Awake() - { - company.AddWorkplace(this); - company.GetCity().AddWorkplace(this); - } - - void Start() + public override void OnPlace() { + city = GameObject.Find("GameManager").GetComponent(); + city.AddWorkplace(GetComponent()); TimeManager.OnHourUpdate += OnHourUpdate; - } void OnTriggerEnter2D(Collider2D collision) diff --git a/Assets/Sprites/house.png.meta b/Assets/Sprites/house.png.meta index a5b15d6..b7a29bd 100644 --- a/Assets/Sprites/house.png.meta +++ b/Assets/Sprites/house.png.meta @@ -68,7 +68,7 @@ TextureImporter: platformSettings: - serializedVersion: 3 buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 + maxTextureSize: 4096 resizeAlgorithm: 0 textureFormat: -1 textureCompression: 0 diff --git a/Assets/Sprites/way_normal.png b/Assets/Sprites/way_normal.png index 5e2dc0d..16b932d 100644 Binary files a/Assets/Sprites/way_normal.png and b/Assets/Sprites/way_normal.png differ diff --git a/Assets/Sprites/workplace.aseprite b/Assets/Sprites/workplace.aseprite new file mode 100644 index 0000000..1b177fa Binary files /dev/null and b/Assets/Sprites/workplace.aseprite differ diff --git a/Assets/Objects/PlacedObjectsSO/City.asset.meta b/Assets/Sprites/workplace.aseprite.meta similarity index 52% rename from Assets/Objects/PlacedObjectsSO/City.asset.meta rename to Assets/Sprites/workplace.aseprite.meta index ab23319..470ea9c 100644 --- a/Assets/Objects/PlacedObjectsSO/City.asset.meta +++ b/Assets/Sprites/workplace.aseprite.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 -guid: 71956a4ddccdfb34fb39b1a383dd126e -NativeFormatImporter: +guid: 22f8a37be0f765d40a39bdbb4444910e +DefaultImporter: externalObjects: {} - mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Sprites/workplace.png b/Assets/Sprites/workplace.png new file mode 100644 index 0000000..eca365c Binary files /dev/null and b/Assets/Sprites/workplace.png differ diff --git a/Assets/Sprites/workplace.png.meta b/Assets/Sprites/workplace.png.meta new file mode 100644 index 0000000..9e0d879 --- /dev/null +++ b/Assets/Sprites/workplace.png.meta @@ -0,0 +1,135 @@ +fileFormatVersion: 2 +guid: d20366dbe5863874cb8337292e5afbaa +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 6 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 32 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: