From fa255c637f3ef91192eac785bf2b83ccb0ab96dc Mon Sep 17 00:00:00 2001 From: JulianKirk Date: Fri, 23 Jun 2023 07:07:18 +1000 Subject: [PATCH] some more changes --- .../Assets/Scenes/MainMenu.unity | 34 +++--- .../Humans/StateMachine/HumanDecisiveState.cs | 2 +- .../Humans/StateMachine/HumanStateManager.cs | 4 +- .../StateMachines/EntityStateManager.cs | 16 ++- .../Layouts/CurrentMaximizeLayout.dwlt | 108 +++++++++--------- 5 files changed, 85 insertions(+), 79 deletions(-) diff --git a/SDD2023-SocialSim/Assets/Scenes/MainMenu.unity b/SDD2023-SocialSim/Assets/Scenes/MainMenu.unity index 565c0f7..4798aed 100644 --- a/SDD2023-SocialSim/Assets/Scenes/MainMenu.unity +++ b/SDD2023-SocialSim/Assets/Scenes/MainMenu.unity @@ -1716,8 +1716,8 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1502215160} - m_RootOrder: 0 + m_Father: {fileID: 495834810} + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1820,7 +1820,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: Back + m_text: Exit m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 25be80cecf58edd4d9074b75ddcb79c6, type: 2} m_sharedMaterial: {fileID: 7306700722704891338, guid: 25be80cecf58edd4d9074b75ddcb79c6, type: 2} @@ -2319,8 +2319,12 @@ RectTransform: - {fileID: 193189739} - {fileID: 447506523} - {fileID: 68675815} + - {fileID: 418454518} + - {fileID: 1111207468} + - {fileID: 838228398} + - {fileID: 1361949739} m_Father: {fileID: 1502215160} - m_RootOrder: 4 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -3010,7 +3014,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: Exit + m_text: Back m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 25be80cecf58edd4d9074b75ddcb79c6, type: 2} m_sharedMaterial: {fileID: 7306700722704891338, guid: 25be80cecf58edd4d9074b75ddcb79c6, type: 2} @@ -3642,8 +3646,8 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1502215160} - m_RootOrder: 2 + m_Father: {fileID: 495834810} + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -4141,7 +4145,7 @@ RectTransform: - {fileID: 615366736} - {fileID: 2019082130} m_Father: {fileID: 1502215160} - m_RootOrder: 5 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -4518,8 +4522,8 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1502215160} - m_RootOrder: 1 + m_Father: {fileID: 495834810} + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -5209,7 +5213,7 @@ RectTransform: - {fileID: 1182863980} - {fileID: 1392758887} m_Father: {fileID: 1502215160} - m_RootOrder: 6 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -5449,8 +5453,8 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1502215160} - m_RootOrder: 3 + m_Father: {fileID: 495834810} + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -6318,10 +6322,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 418454518} - - {fileID: 1111207468} - - {fileID: 838228398} - - {fileID: 1361949739} - {fileID: 495834810} - {fileID: 974370039} - {fileID: 1270702284} diff --git a/SDD2023-SocialSim/Assets/Scripts/Humans/StateMachine/HumanDecisiveState.cs b/SDD2023-SocialSim/Assets/Scripts/Humans/StateMachine/HumanDecisiveState.cs index fa5b48b..b9e9112 100644 --- a/SDD2023-SocialSim/Assets/Scripts/Humans/StateMachine/HumanDecisiveState.cs +++ b/SDD2023-SocialSim/Assets/Scripts/Humans/StateMachine/HumanDecisiveState.cs @@ -10,7 +10,7 @@ public override void EnterState(HumanStateManager master) { if (master.m_inventory.m_currentWeight == master.m_inventory.m_maxWeight) { - if (master.homeOwner && master.m_inventory.GetFoodWeight() > 50f /*&& master.houseInventory.m_currentWeight > (30 * (master.NumberOfChildren + 1))*/) + if (master.homeOwner && (master.m_inventory.GetFoodWeight() > 40f || master.houseInventory.GetFoodWeight() > 25f)) //They will try to have new children if they are able to support them { master.SwitchState(master.seekPartnerState); diff --git a/SDD2023-SocialSim/Assets/Scripts/Humans/StateMachine/HumanStateManager.cs b/SDD2023-SocialSim/Assets/Scripts/Humans/StateMachine/HumanStateManager.cs index 2c4a096..22d5717 100644 --- a/SDD2023-SocialSim/Assets/Scripts/Humans/StateMachine/HumanStateManager.cs +++ b/SDD2023-SocialSim/Assets/Scripts/Humans/StateMachine/HumanStateManager.cs @@ -190,8 +190,6 @@ protected override void OnNewMonth() { if ((m_inventory.GetFoodWeight()) < (-m_age * (m_age - 100f) * (0.006f))) //They starve if they don't have enough food { - Debug.Log("I starved during the " + m_currentState + " state."); - WorldManager.RESULTS.deathsByCauses["Starvation"] += 1; Die(); @@ -232,6 +230,8 @@ protected override void OnNewMonth() if (Random.Range(0, 100) < 5) //5% chance to die from disease { WorldManager.RESULTS.deathsByCauses["Disease"] += 1; + + Die(); } } diff --git a/SDD2023-SocialSim/Assets/Scripts/NPC_Common/StateMachines/EntityStateManager.cs b/SDD2023-SocialSim/Assets/Scripts/NPC_Common/StateMachines/EntityStateManager.cs index e7d3eec..ecc896c 100644 --- a/SDD2023-SocialSim/Assets/Scripts/NPC_Common/StateMachines/EntityStateManager.cs +++ b/SDD2023-SocialSim/Assets/Scripts/NPC_Common/StateMachines/EntityStateManager.cs @@ -72,17 +72,23 @@ public virtual void SwitchState(State newState) {} if (currentPath == null || currentPath.Count < 1) { - Debug.Log("Destination is unreachable"); + // Debug.Log("Destination is unreachable"); return false; } else { - currentTarget = currentPath[0]; + try + { + currentTarget = currentPath[0]; - rBody.velocity = new Vector2(currentTarget.xPos - transform.position.x, currentTarget.yPos - transform.position.y); - rBody.velocity.Normalize(); - rBody.velocity = rBody.velocity * m_speed; + rBody.velocity = new Vector2(currentTarget.xPos - transform.position.x, currentTarget.yPos - transform.position.y); + rBody.velocity.Normalize(); + rBody.velocity = rBody.velocity * m_speed; + } + catch + { + } return true; } } diff --git a/SDD2023-SocialSim/UserSettings/Layouts/CurrentMaximizeLayout.dwlt b/SDD2023-SocialSim/UserSettings/Layouts/CurrentMaximizeLayout.dwlt index b48ca63..c4a7a8d 100644 --- a/SDD2023-SocialSim/UserSettings/Layouts/CurrentMaximizeLayout.dwlt +++ b/SDD2023-SocialSim/UserSettings/Layouts/CurrentMaximizeLayout.dwlt @@ -24,7 +24,7 @@ MonoBehaviour: m_MinSize: {x: 300, y: 200} m_MaxSize: {x: 24288, y: 16192} vertical: 0 - controlID: 9863 + controlID: 14881 --- !u!114 &2 MonoBehaviour: m_ObjectHideFlags: 52 @@ -45,9 +45,9 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 476 + x: 261 y: 341 - width: 674 + width: 889 height: 530 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: @@ -59,7 +59,7 @@ MonoBehaviour: m_ShowGizmos: 0 m_TargetDisplay: 0 m_ClearColor: {r: 0, g: 0, b: 0, a: 0} - m_TargetSize: {x: 674, y: 509} + m_TargetSize: {x: 889, y: 509} m_TextureFilterMode: 0 m_TextureHideFlags: 61 m_RenderIMGUI: 1 @@ -74,8 +74,8 @@ MonoBehaviour: m_VRangeLocked: 0 hZoomLockedByDefault: 0 vZoomLockedByDefault: 0 - m_HBaseRangeMin: -168.5 - m_HBaseRangeMax: 168.5 + m_HBaseRangeMin: -222.25 + m_HBaseRangeMax: 222.25 m_VBaseRangeMin: -127.25 m_VBaseRangeMax: 127.25 m_HAllowExceedBaseRangeMin: 1 @@ -86,7 +86,7 @@ MonoBehaviour: m_HSlider: 0 m_VSlider: 0 m_IgnoreScrollWheelUntilClicked: 0 - m_EnableMouseInput: 0 + m_EnableMouseInput: 1 m_EnableSliderZoomHorizontal: 0 m_EnableSliderZoomVertical: 0 m_UniformScale: 1 @@ -95,23 +95,23 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 21 - width: 674 + width: 889 height: 509 m_Scale: {x: 2, y: 2} - m_Translation: {x: 337, y: 254.5} + m_Translation: {x: 444.5, y: 254.5} m_MarginLeft: 0 m_MarginRight: 0 m_MarginTop: 0 m_MarginBottom: 0 m_LastShownAreaInsideMargins: serializedVersion: 2 - x: -168.5 + x: -222.25 y: -127.25 - width: 337 + width: 444.5 height: 254.5 m_MinimalGUI: 1 m_defaultScale: 2 - m_LastWindowPixelSize: {x: 1348, y: 1060} + m_LastWindowPixelSize: {x: 1778, y: 1060} m_ClearInEditMode: 1 m_NoCameraWarning: 1 m_LowResolutionForAspectRatios: 01000000000000000000 @@ -141,7 +141,7 @@ MonoBehaviour: m_MinSize: {x: 200, y: 200} m_MaxSize: {x: 16192, y: 16192} vertical: 0 - controlID: 9864 + controlID: 14882 --- !u!114 &4 MonoBehaviour: m_ObjectHideFlags: 52 @@ -161,12 +161,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 476 + width: 261 height: 820 m_MinSize: {x: 100, y: 200} m_MaxSize: {x: 8096, y: 16192} vertical: 1 - controlID: 9875 + controlID: 14803 --- !u!114 &5 MonoBehaviour: m_ObjectHideFlags: 52 @@ -184,7 +184,7 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 476 + width: 261 height: 476 m_MinSize: {x: 201, y: 221} m_MaxSize: {x: 4001, y: 4021} @@ -215,7 +215,7 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 72 - width: 475 + width: 260 height: 455 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: @@ -224,9 +224,9 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: - m_LastClickedID: 0 - m_ExpandedIDs: e087feff42edffff26fbffff7a600000e8600000f08e00004e8f0000588f0000 + m_SelectedIDs: ac0301009a04010044040100e8040100 + m_LastClickedID: 66476 + m_ExpandedIDs: 08e7fcfff418fdff441afdffec62fdff8664fdffd264fdff8c66fdffa266fdffae66fdffb877fdff0478fdffaa79fdffc079fdffcc79fdffe087feff42edffff26fbffff7a600000e8600000f08e00004e8f0000588f0000e8c2000000c30000aec30000e6c300004cc4000056c4000010df0000a2df000088e00000eee00000f8e00000dc030100c20401002805010032050100 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -260,24 +260,24 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: ConsoleWindow + m_Name: ProjectBrowser m_EditorClassIdentifier: m_Children: [] m_Position: serializedVersion: 2 x: 0 y: 476 - width: 476 + width: 261 height: 344 - m_MinSize: {x: 101, y: 121} - m_MaxSize: {x: 4001, y: 4021} - m_ActualView: {fileID: 9} + m_MinSize: {x: 231, y: 271} + m_MaxSize: {x: 10001, y: 10021} + m_ActualView: {fileID: 8} m_Panes: - {fileID: 8} - {fileID: 9} - {fileID: 10} - m_Selected: 1 - m_LastSelected: 0 + m_Selected: 0 + m_LastSelected: 1 --- !u!114 &8 MonoBehaviour: m_ObjectHideFlags: 52 @@ -300,7 +300,7 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 548 - width: 475 + width: 260 height: 323 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: @@ -319,21 +319,21 @@ MonoBehaviour: m_SkipHidden: 0 m_SearchArea: 1 m_Folders: - - Assets/Art/ExternalAssets/kenney_medieval-rts/PNG/Retina/Unit + - Assets/Scenes m_Globs: [] m_OriginalText: m_ViewMode: 1 m_StartGridSize: 64 m_LastFolders: - - Assets/Art/ExternalAssets/kenney_medieval-rts/PNG/Retina/Unit + - Assets/Scenes m_LastFoldersGridSize: -1 m_LastProjectPath: C:\Users\proga\Documents\UnityProjects\SDD2023_SocialSim\SDD2023-SocialSim m_LockTracker: m_IsLocked: 0 m_FolderTreeState: - scrollPos: {x: 0, y: 245} - m_SelectedIDs: 1c7a0000 - m_LastClickedID: 31260 + scrollPos: {x: 0, y: 85} + m_SelectedIDs: b8620000 + m_LastClickedID: 25272 m_ExpandedIDs: 0000000096620000986200009a6200009c620000aa62000000ca9a3b m_RenameOverlay: m_UserAcceptedRename: 0 @@ -387,8 +387,8 @@ MonoBehaviour: m_Icon: {fileID: 0} m_ResourceFile: m_ListAreaState: - m_SelectedInstanceIDs: - m_LastClickedInstanceID: 0 + m_SelectedInstanceIDs: ac0301009a04010044040100e8040100 + m_LastClickedInstanceID: 66792 m_HadKeyboardFocusLastEvent: 0 m_ExpandedInstanceIDs: c6230000aa5f0000987200000c630000 m_RenameOverlay: @@ -417,7 +417,7 @@ MonoBehaviour: m_ScrollPosition: {x: 0, y: 0} m_GridSize: 64 m_SkipHiddenPackages: 0 - m_DirectoriesAreaWidth: 268 + m_DirectoriesAreaWidth: 134 --- !u!114 &9 MonoBehaviour: m_ObjectHideFlags: 52 @@ -440,7 +440,7 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 548 - width: 475 + width: 537 height: 323 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: @@ -639,14 +639,14 @@ MonoBehaviour: - {fileID: 14} m_Position: serializedVersion: 2 - x: 476 + x: 261 y: 0 - width: 676 + width: 891 height: 820 m_MinSize: {x: 100, y: 200} m_MaxSize: {x: 8096, y: 16192} vertical: 1 - controlID: 9865 + controlID: 14883 --- !u!114 &12 MonoBehaviour: m_ObjectHideFlags: 52 @@ -664,10 +664,10 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 676 + width: 891 height: 269 - m_MinSize: {x: 202, y: 221} - m_MaxSize: {x: 4002, y: 4021} + m_MinSize: {x: 201, y: 221} + m_MaxSize: {x: 4001, y: 4021} m_ActualView: {fileID: 13} m_Panes: - {fileID: 13} @@ -693,9 +693,9 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 476 + x: 261 y: 72 - width: 674 + width: 889 height: 248 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: @@ -953,9 +953,9 @@ MonoBehaviour: m_PlayAudio: 0 m_AudioPlay: 0 m_Position: - m_Target: {x: 365.67148, y: 125.05813, z: 0.07086387} + m_Target: {x: 395.46307, y: 233.80472, z: 2.5236425} speed: 2 - m_Value: {x: 365.67148, y: 125.05813, z: 0.07086387} + m_Value: {x: 395.46307, y: 233.80472, z: 2.5236425} m_RenderMode: 0 m_CameraMode: drawMode: 0 @@ -1006,9 +1006,9 @@ MonoBehaviour: speed: 2 m_Value: {x: 0, y: 0, z: 0, w: 1} m_Size: - m_Target: 411.0966 + m_Target: 278.80707 speed: 2 - m_Value: 411.0966 + m_Value: 278.80707 m_Ortho: m_Target: 1 speed: 2 @@ -1050,10 +1050,10 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 269 - width: 676 + width: 891 height: 551 - m_MinSize: {x: 202, y: 221} - m_MaxSize: {x: 4002, y: 4021} + m_MinSize: {x: 201, y: 221} + m_MaxSize: {x: 4001, y: 4021} m_ActualView: {fileID: 2} m_Panes: - {fileID: 2} @@ -1078,8 +1078,8 @@ MonoBehaviour: y: 0 width: 384 height: 820 - m_MinSize: {x: 275, y: 50} - m_MaxSize: {x: 4000, y: 4000} + m_MinSize: {x: 276, y: 71} + m_MaxSize: {x: 4001, y: 4021} m_ActualView: {fileID: 16} m_Panes: - {fileID: 16}