From 884103d805270bd776b7a485d9431401c0c05594 Mon Sep 17 00:00:00 2001
From: miepzerino <o.skotnik@gmail.com>
Date: Sun, 30 Mar 2025 18:50:13 +0000
Subject: [PATCH] #16 added ores to player inventory #14 show inventory in UI
---
Assets/InputSystem.inputsettings.asset | 36 ++
Assets/Scripts/Inventory/InventoryDisplay.cs.meta | 11
Assets/Scripts/PlayerController.cs | 2
Assets/Scripts/Events/GameStateEvents.cs.meta | 11
Assets/Scenes/GameplayScene.unity | 356 +++++++++------------------
Assets/Scripts/Events/GameStateEvents.cs | 11
Assets/Scripts/Inventory/InventoryDisplay.cs | 163 ++++++++++++
Assets/Characters/Player/GrayNinja/PlayerInputActions.inputactions | 31 ++
ProjectSettings/EditorBuildSettings.asset | 3
Assets/Scripts/Inventory/Inventory.cs | 23 +
Assets/Scripts/Managers/GameManager.cs | 32 ++
Assets/Scripts/PauseMenu.cs | 24 -
Assets/Scripts/Drilling/Dropable.cs | 2
Assets/TileSets/Palettes/DrillIronOre.prefab | 2
Assets/InputSystem.inputsettings.asset.meta | 8
Assets/Prefabs/UI/ItemUI.prefab | 6
16 files changed, 445 insertions(+), 276 deletions(-)
diff --git a/Assets/Characters/Player/GrayNinja/PlayerInputActions.inputactions b/Assets/Characters/Player/GrayNinja/PlayerInputActions.inputactions
index de093a3..1d4f10f 100644
--- a/Assets/Characters/Player/GrayNinja/PlayerInputActions.inputactions
+++ b/Assets/Characters/Player/GrayNinja/PlayerInputActions.inputactions
@@ -358,6 +358,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
+ },
+ {
+ "name": "Inventory",
+ "type": "Button",
+ "id": "b425611e-206f-4a50-938e-ad263b5330a1",
+ "expectedControlType": "Button",
+ "processors": "",
+ "interactions": "",
+ "initialStateCheck": false
}
],
"bindings": [
@@ -789,6 +798,28 @@
"action": "Escape",
"isComposite": false,
"isPartOfComposite": false
+ },
+ {
+ "name": "",
+ "id": "1438d6b5-7319-4660-86b3-d9d61e833179",
+ "path": "<Keyboard>/b",
+ "interactions": "",
+ "processors": "",
+ "groups": "Keyboard&Mouse",
+ "action": "Inventory",
+ "isComposite": false,
+ "isPartOfComposite": false
+ },
+ {
+ "name": "",
+ "id": "e7cd7446-649d-436b-bafd-13577f40d4cc",
+ "path": "<Keyboard>/i",
+ "interactions": "",
+ "processors": "",
+ "groups": "Keyboard&Mouse",
+ "action": "Inventory",
+ "isComposite": false,
+ "isPartOfComposite": false
}
]
}
diff --git a/Assets/InputSystem.inputsettings.asset b/Assets/InputSystem.inputsettings.asset
new file mode 100644
index 0000000..170571f
--- /dev/null
+++ b/Assets/InputSystem.inputsettings.asset
@@ -0,0 +1,36 @@
+%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: c46f07b5ed07e4e92aa78254188d3d10, type: 3}
+ m_Name: InputSystem.inputsettings
+ m_EditorClassIdentifier:
+ m_SupportedDevices: []
+ m_UpdateMode: 1
+ m_MaxEventBytesPerUpdate: 5242880
+ m_MaxQueuedEventsPerUpdate: 1000
+ m_CompensateForScreenOrientation: 1
+ m_BackgroundBehavior: 0
+ m_EditorInputBehaviorInPlayMode: 0
+ m_DefaultDeadzoneMin: 0.125
+ m_DefaultDeadzoneMax: 0.925
+ m_DefaultButtonPressPoint: 0.5
+ m_ButtonReleaseThreshold: 0.75
+ m_DefaultTapTime: 0.2
+ m_DefaultSlowTapTime: 0.5
+ m_DefaultHoldTime: 0.4
+ m_TapRadius: 5
+ m_MultiTapDelayTime: 0.75
+ m_DisableRedundantEventsMerging: 0
+ m_ShortcutKeysConsumeInputs: 0
+ m_iOSSettings:
+ m_MotionUsage:
+ m_Enabled: 0
+ m_Description:
diff --git a/Assets/InputSystem.inputsettings.asset.meta b/Assets/InputSystem.inputsettings.asset.meta
new file mode 100644
index 0000000..5a23145
--- /dev/null
+++ b/Assets/InputSystem.inputsettings.asset.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7e04de496fcdd9940a7686f07b3ded72
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 11400000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Prefabs/UI/ItemUI.prefab b/Assets/Prefabs/UI/ItemUI.prefab
index 5d7b568..25f99f1 100644
--- a/Assets/Prefabs/UI/ItemUI.prefab
+++ b/Assets/Prefabs/UI/ItemUI.prefab
@@ -109,7 +109,7 @@
- component: {fileID: 9129402677742143197}
- component: {fileID: 1509318746141574566}
m_Layer: 5
- m_Name: Image
+ m_Name: ItemIcon
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -205,7 +205,7 @@
- component: {fileID: 8060713024910017430}
- component: {fileID: 3468394198093522130}
m_Layer: 5
- m_Name: Name
+ m_Name: ItemName
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -456,7 +456,7 @@
- component: {fileID: 4160423452763138429}
- component: {fileID: 5673905517171404058}
m_Layer: 5
- m_Name: Amount
+ m_Name: ItemQuantity
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
diff --git a/Assets/Scenes/GameplayScene.unity b/Assets/Scenes/GameplayScene.unity
index f6892c3..1a41c6e 100644
--- a/Assets/Scenes/GameplayScene.unity
+++ b/Assets/Scenes/GameplayScene.unity
@@ -1002,7 +1002,7 @@
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
- m_IsActive: 1
+ m_IsActive: 0
--- !u!224 &265072080
RectTransform:
m_ObjectHideFlags: 0
@@ -1255,10 +1255,10 @@
m_Children: []
m_Father: {fileID: 1608987571}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0, y: 0}
- m_AnchorMax: {x: 0, y: 0}
- m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 0, y: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 165.0625, y: -37.5}
+ m_SizeDelta: {x: 216.12502, y: 28.48}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &346249438
MonoBehaviour:
@@ -1745,7 +1745,7 @@
m_GameObject: {fileID: 519420028}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: 0, y: 0, z: -10}
+ m_LocalPosition: {x: -6.15, y: -24.87, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -1818,10 +1818,10 @@
m_Children: []
m_Father: {fileID: 1608987571}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0, y: 0}
- m_AnchorMax: {x: 0, y: 0}
- m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 0, y: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 420, y: -37.5}
+ m_SizeDelta: {x: 141.87502, y: 28.48}
m_Pivot: {x: 1, y: 0.5}
--- !u!114 &551699620
MonoBehaviour:
@@ -2189,7 +2189,7 @@
m_Father: {fileID: 1076034262}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
- m_AnchorMax: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0.000030517578, y: -0.5}
m_SizeDelta: {x: 20, y: 0.80810547}
m_Pivot: {x: 0.5, y: 0.5}
@@ -2956,7 +2956,7 @@
m_TargetGraphic: {fileID: 641607429}
m_HandleRect: {fileID: 641607428}
m_Direction: 2
- m_Value: 0
+ m_Value: 1
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
@@ -4015,15 +4015,15 @@
LayoutRotation: {x: 0, y: 0, z: 0, w: 1}
AdapterBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 460.00003, y: 441.6893, z: 0}
+ m_Extent: {x: 460.00003, y: 335.2963, z: 0}
LayoutBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 460.00003, y: 441.6893, z: 0}
+ m_Extent: {x: 460.00003, y: 335.2963, z: 0}
RotatedAndScaledBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 460.00003, y: 441.6893, z: 0}
+ m_Extent: {x: 460.00003, y: 335.2963, z: 0}
ComponentScale: {x: 1, y: 1, z: 1}
- FillSize: {x: 960.00006, y: 933.3786, z: 0}
+ FillSize: {x: 960.00006, y: 720.5926, z: 0}
ShrinkSize: {x: 999999, y: 999999, z: 999999}
TargetPosition: {x: 0, y: 0, z: 0}
TargetRotation: {x: 0, y: 0, z: 0, w: 1}
@@ -4114,10 +4114,10 @@
m_Children: []
m_Father: {fileID: 1608987571}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0, y: 0}
- m_AnchorMax: {x: 0, y: 0}
- m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 0, y: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 20, y: -37.5}
+ m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &1200640578
MonoBehaviour:
@@ -5185,175 +5185,6 @@
e31: 0
e32: 0
e33: 1
---- !u!1001 &1334816339
-PrefabInstance:
- m_ObjectHideFlags: 0
- serializedVersion: 2
- m_Modification:
- serializedVersion: 3
- m_TransformParent: {fileID: 1485359864}
- m_Modifications:
- - target: {fileID: 1275882509701186921, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMax.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1275882509701186921, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMin.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1275882509701186921, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_SizeDelta.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1275882509701186921, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_SizeDelta.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1275882509701186921, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchoredPosition.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1275882509701186921, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchoredPosition.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 1536595002982607090, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_Name
- value: ItemUI
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_Pivot.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_Pivot.y
- value: 1
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMax.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMax.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMin.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMin.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_SizeDelta.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_SizeDelta.y
- value: 40
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalPosition.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalPosition.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalPosition.z
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalRotation.w
- value: 1
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalRotation.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalRotation.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalRotation.z
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchoredPosition.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchoredPosition.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalEulerAnglesHint.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalEulerAnglesHint.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_LocalEulerAnglesHint.z
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 7696710864840045124, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMax.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 7696710864840045124, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMin.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 7696710864840045124, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_SizeDelta.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 7696710864840045124, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_SizeDelta.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 7696710864840045124, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchoredPosition.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 7696710864840045124, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchoredPosition.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 8388742664727129963, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMax.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 8388742664727129963, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchorMin.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 8388742664727129963, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_SizeDelta.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 8388742664727129963, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_SizeDelta.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 8388742664727129963, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchoredPosition.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 8388742664727129963, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- propertyPath: m_AnchoredPosition.y
- value: 0
- objectReference: {fileID: 0}
- m_RemovedComponents: []
- m_RemovedGameObjects: []
- m_AddedGameObjects: []
- m_AddedComponents: []
- m_SourcePrefab: {fileID: 100100000, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
--- !u!1 &1371296120
GameObject:
m_ObjectHideFlags: 0
@@ -5394,7 +5225,7 @@
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 460.00003, y: 883.3786}
+ m_SizeDelta: {x: 460.00003, y: 670.5926}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1371296122
MonoBehaviour:
@@ -5414,24 +5245,24 @@
LayoutRotation: {x: 0, y: 0, z: 0, w: 1}
AdapterBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 230.00002, y: 441.6893, z: 0}
+ m_Extent: {x: 230.00002, y: 335.2963, z: 0}
LayoutBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 230.00002, y: 441.6893, z: 0}
+ m_Extent: {x: 230.00002, y: 335.2963, z: 0}
RotatedAndScaledBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 230.00002, y: 441.6893, z: 0}
+ m_Extent: {x: 230.00002, y: 335.2963, z: 0}
ComponentScale: {x: 1, y: 1, z: 1}
- FillSize: {x: 460.00003, y: 883.3786, z: 0}
+ FillSize: {x: 460.00003, y: 670.5926, z: 0}
ShrinkSize: {x: 999999, y: 999999, z: 999999}
TargetPosition: {x: 0, y: 0, z: 0}
TargetRotation: {x: 0, y: 0, z: 0, w: 1}
TargetScale: {x: 1, y: 1, z: 1}
- TargetRectSize: {x: 460.00003, y: 883.3786, z: 0}
+ TargetRectSize: {x: 460.00003, y: 670.5926, z: 0}
TransformPosition: {x: 0, y: 0, z: 0}
TransformRotation: {x: 0, y: 0, z: 0, w: 1}
TransformScale: {x: 1, y: 1, z: 1}
- TransformRectSize: {x: 460.00003, y: 883.3786}
+ TransformRectSize: {x: 460.00003, y: 670.5926}
--- !u!114 &1371296123
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -5694,14 +5525,13 @@
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
- m_Children:
- - {fileID: 1776915588}
+ m_Children: []
m_Father: {fileID: 603134992}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
- m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: -0.000061035156}
+ m_SizeDelta: {x: 0, y: -610.5926}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1485359865
MonoBehaviour:
@@ -5782,7 +5612,7 @@
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 960.00006, y: 933.3786}
+ m_SizeDelta: {x: 960.00006, y: 720.5926}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1518638838
MonoBehaviour:
@@ -5922,24 +5752,24 @@
LayoutRotation: {x: 0, y: 0, z: 0, w: 1}
AdapterBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 480.00003, y: 466.6893, z: 0}
+ m_Extent: {x: 480.00003, y: 360.2963, z: 0}
LayoutBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 480.00003, y: 466.6893, z: 0}
+ m_Extent: {x: 480.00003, y: 360.2963, z: 0}
RotatedAndScaledBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 480.00003, y: 466.6893, z: 0}
+ m_Extent: {x: 480.00003, y: 360.2963, z: 0}
ComponentScale: {x: 1, y: 1, z: 1}
- FillSize: {x: 1600, y: 1166.7233, z: 0}
+ FillSize: {x: 1600, y: 900.7407, z: 0}
ShrinkSize: {x: 999999, y: 999999, z: 999999}
TargetPosition: {x: 0, y: 0, z: 0}
TargetRotation: {x: 0, y: 0, z: 0, w: 1}
TargetScale: {x: 1, y: 1, z: 1}
- TargetRectSize: {x: 960.00006, y: 933.3786, z: 0}
+ TargetRectSize: {x: 960.00006, y: 720.5926, z: 0}
TransformPosition: {x: 0, y: 0, z: 0}
TransformRotation: {x: 0, y: 0, z: 0, w: 1}
TransformScale: {x: 1, y: 1, z: 1}
- TransformRectSize: {x: 960.00006, y: 933.3786}
+ TransformRectSize: {x: 960.00006, y: 720.5926}
--- !u!1 &1555532322 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8421115849835234403, guid: 19b26cb080fd5b841970a693f820fc0f, type: 3}
@@ -6458,7 +6288,7 @@
m_GameObject: {fileID: 1624236510}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: 0, y: 0, z: -10}
+ m_LocalPosition: {x: -6.15, y: -24.87, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@@ -6797,15 +6627,15 @@
LayoutRotation: {x: 0, y: 0, z: 0, w: 1}
AdapterBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 220.00002, y: 441.6893, z: 0}
+ m_Extent: {x: 220.00002, y: 335.2963, z: 0}
LayoutBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 220.00002, y: 441.6893, z: 0}
+ m_Extent: {x: 220.00002, y: 335.2963, z: 0}
RotatedAndScaledBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 220.00002, y: 441.6893, z: 0}
+ m_Extent: {x: 220.00002, y: 335.2963, z: 0}
ComponentScale: {x: 1, y: 1, z: 1}
- FillSize: {x: 460.00003, y: 883.3786, z: 0}
+ FillSize: {x: 460.00003, y: 670.5926, z: 0}
ShrinkSize: {x: 999999, y: 999999, z: 999999}
TargetPosition: {x: 240.00002, y: 0, z: 0}
TargetRotation: {x: 0, y: 0, z: 0, w: 1}
@@ -6865,11 +6695,6 @@
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
---- !u!224 &1776915588 stripped
-RectTransform:
- m_CorrespondingSourceObject: {fileID: 6633370595712293001, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
- m_PrefabInstance: {fileID: 1334816339}
- m_PrefabAsset: {fileID: 0}
--- !u!1 &1822943456
GameObject:
m_ObjectHideFlags: 0
@@ -6908,7 +6733,7 @@
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -47.5}
- m_SizeDelta: {x: 440.00003, y: 788.3786}
+ m_SizeDelta: {x: 440.00003, y: 575.5926}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1822943458
MonoBehaviour:
@@ -7022,24 +6847,24 @@
LayoutRotation: {x: 0, y: 0, z: 0, w: 1}
AdapterBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 220.00002, y: 394.1893, z: 0}
+ m_Extent: {x: 220.00002, y: 287.7963, z: 0}
LayoutBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 220.00002, y: 394.1893, z: 0}
+ m_Extent: {x: 220.00002, y: 287.7963, z: 0}
RotatedAndScaledBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 220.00002, y: 394.1893, z: 0}
+ m_Extent: {x: 220.00002, y: 287.7963, z: 0}
ComponentScale: {x: 1, y: 1, z: 1}
- FillSize: {x: 440.00003, y: 788.3786, z: 0}
+ FillSize: {x: 440.00003, y: 575.5926, z: 0}
ShrinkSize: {x: 999999, y: 999999, z: 999999}
TargetPosition: {x: 0, y: -47.5, z: 0}
TargetRotation: {x: 0, y: 0, z: 0, w: 1}
TargetScale: {x: 1, y: 1, z: 1}
- TargetRectSize: {x: 440.00003, y: 788.3786, z: 0}
+ TargetRectSize: {x: 440.00003, y: 575.5926, z: 0}
TransformPosition: {x: 0, y: -47.5, z: 0}
TransformRotation: {x: 0, y: 0, z: 0, w: 1}
TransformScale: {x: 1, y: 1, z: 1}
- TransformRectSize: {x: 440.00003, y: 788.3786}
+ TransformRectSize: {x: 440.00003, y: 575.5926}
--- !u!1 &1829940152
GameObject:
m_ObjectHideFlags: 0
@@ -7077,7 +6902,7 @@
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, y: 404.1893}
+ m_AnchoredPosition: {x: 0, y: 297.7963}
m_SizeDelta: {x: 440.00003, y: 75}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1829940154
@@ -7188,7 +7013,7 @@
m_EditorClassIdentifier:
Parent: {fileID: 1668905855}
SiblingIndex: 0
- LayoutPosition: {x: 0, y: 404.1893, z: 0}
+ LayoutPosition: {x: 0, y: 297.7963, z: 0}
LayoutRotation: {x: 0, y: 0, z: 0, w: 1}
AdapterBounds:
m_Center: {x: 0, y: 0, z: 0}
@@ -7202,11 +7027,11 @@
ComponentScale: {x: 1, y: 1, z: 1}
FillSize: {x: 440.00003, y: 0, z: 0}
ShrinkSize: {x: 999999, y: 999999, z: 999999}
- TargetPosition: {x: 0, y: 404.1893, z: 0}
+ TargetPosition: {x: 0, y: 297.7963, z: 0}
TargetRotation: {x: 0, y: 0, z: 0, w: 1}
TargetScale: {x: 1, y: 1, z: 1}
TargetRectSize: {x: 440.00003, y: 75, z: 0}
- TransformPosition: {x: 0, y: 404.1893, z: 0}
+ TransformPosition: {x: 0, y: 297.7963, z: 0}
TransformRotation: {x: 0, y: 0, z: 0, w: 1}
TransformScale: {x: 1, y: 1, z: 1}
TransformRectSize: {x: 440.00003, y: 75}
@@ -7626,7 +7451,7 @@
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -230.00002, y: 0}
- m_SizeDelta: {x: 460.00003, y: 883.3786}
+ m_SizeDelta: {x: 460.00003, y: 670.5926}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1960090178
MonoBehaviour:
@@ -7766,24 +7591,24 @@
LayoutRotation: {x: 0, y: 0, z: 0, w: 1}
AdapterBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 230.00002, y: 441.6893, z: 0}
+ m_Extent: {x: 230.00002, y: 335.2963, z: 0}
LayoutBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 230.00002, y: 441.6893, z: 0}
+ m_Extent: {x: 230.00002, y: 335.2963, z: 0}
RotatedAndScaledBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 230.00002, y: 441.6893, z: 0}
+ m_Extent: {x: 230.00002, y: 335.2963, z: 0}
ComponentScale: {x: 1, y: 1, z: 1}
- FillSize: {x: 460.00003, y: 883.3786, z: 0}
+ FillSize: {x: 460.00003, y: 670.5926, z: 0}
ShrinkSize: {x: 999999, y: 999999, z: 999999}
TargetPosition: {x: -230.00002, y: 0, z: 0}
TargetRotation: {x: 0, y: 0, z: 0, w: 1}
TargetScale: {x: 1, y: 1, z: 1}
- TargetRectSize: {x: 460.00003, y: 883.3786, z: 0}
+ TargetRectSize: {x: 460.00003, y: 670.5926, z: 0}
TransformPosition: {x: -230.00002, y: 0, z: 0}
TransformRotation: {x: 0, y: 0, z: 0, w: 1}
TransformScale: {x: 1, y: 1, z: 1}
- TransformRectSize: {x: 460.00003, y: 883.3786}
+ TransformRectSize: {x: 460.00003, y: 670.5926}
--- !u!1 &2010473985
GameObject:
m_ObjectHideFlags: 0
@@ -7953,6 +7778,7 @@
- component: {fileID: 2064964504}
- component: {fileID: 2064964506}
- component: {fileID: 2064964505}
+ - component: {fileID: 2064964507}
m_Layer: 5
m_Name: UI
m_TagString: Untagged
@@ -8097,6 +7923,22 @@
settingsMenuUI: {fileID: 109537919}
pausePanel: {fileID: 1562124018}
saveGameText: {fileID: 1219825711}
+--- !u!114 &2064964507
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2064964499}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 83ed442b2279fb147b128b439a8c63aa, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ inventoryPanel: {fileID: 265072079}
+ itemContent: {fileID: 1485359863}
+ itemUIPrefab: {fileID: 1536595002982607090, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
+ itemUIs: []
--- !u!1001 &2118694763
PrefabInstance:
m_ObjectHideFlags: 0
@@ -8306,13 +8148,53 @@
value:
objectReference: {fileID: 977175855}
- target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.size
+ value: 15
+ objectReference: {fileID: 0}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.data[14].m_ActionId
+ value: b425611e-206f-4a50-938e-ad263b5330a1
+ objectReference: {fileID: 0}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.data[14].m_ActionName
+ value: UI/Inventory[/Keyboard/b,/Keyboard/i]
+ objectReference: {fileID: 0}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.size
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Mode
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 2064964506}
- target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Target
+ value:
+ objectReference: {fileID: 2064964507}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_CallState
+ value: 2
+ objectReference: {fileID: 0}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: OnEscapedPressed
objectReference: {fileID: 0}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
+ value: OnInventoryButtonPressed
+ objectReference: {fileID: 0}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
+ value: InventoryDisplay, Assembly-CSharp
+ objectReference: {fileID: 0}
+ - target: {fileID: 7748736149887392517, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
+ value: UnityEngine.Object, UnityEngine
+ objectReference: {fileID: 0}
- target: {fileID: 8598998496262044661, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
propertyPath: m_Name
value: GameManager
@@ -8351,11 +8233,11 @@
objectReference: {fileID: 0}
- target: {fileID: 2368348636056148999, guid: c220ec455fce341408d66d880b464cad, type: 3}
propertyPath: m_LocalPosition.x
- value: 0
+ value: -6.15
objectReference: {fileID: 0}
- target: {fileID: 2368348636056148999, guid: c220ec455fce341408d66d880b464cad, type: 3}
propertyPath: m_LocalPosition.y
- value: 0
+ value: -24.87
objectReference: {fileID: 0}
- target: {fileID: 2368348636056148999, guid: c220ec455fce341408d66d880b464cad, type: 3}
propertyPath: m_LocalPosition.z
diff --git a/Assets/Scripts/Drilling/Dropable.cs b/Assets/Scripts/Drilling/Dropable.cs
index 8cf199a..a3ab920 100644
--- a/Assets/Scripts/Drilling/Dropable.cs
+++ b/Assets/Scripts/Drilling/Dropable.cs
@@ -5,5 +5,5 @@
public class Dropable : MonoBehaviour
{
public bool isDropable = true;
- public GameObject dropable;
+ public Item dropable;
}
diff --git a/Assets/Scripts/Events/GameStateEvents.cs b/Assets/Scripts/Events/GameStateEvents.cs
new file mode 100644
index 0000000..deed42d
--- /dev/null
+++ b/Assets/Scripts/Events/GameStateEvents.cs
@@ -0,0 +1,11 @@
+using Assets.Scripts.Enums;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Events;
+
+public class GameStateEvents : MonoBehaviour
+{
+ //public static UnityAction<bool> gameStatePauseChanged;
+ public static UnityAction inventoryChanged;
+}
diff --git a/Assets/Scripts/Events/GameStateEvents.cs.meta b/Assets/Scripts/Events/GameStateEvents.cs.meta
new file mode 100644
index 0000000..3098e70
--- /dev/null
+++ b/Assets/Scripts/Events/GameStateEvents.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: aaf3d56a97bf2d442949a8bbb606d4fb
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Inventory/Inventory.cs b/Assets/Scripts/Inventory/Inventory.cs
index a8a59b5..edb224e 100644
--- a/Assets/Scripts/Inventory/Inventory.cs
+++ b/Assets/Scripts/Inventory/Inventory.cs
@@ -23,33 +23,37 @@
public bool AddItem(Item item, int quantity = 1)
{
if (items.Count >= maxInventorySize && !item.isStackable)
+ {
+ //TODO: Show inventory full message
+ Debug.Log("Inventory is full");
return false;
+ }
InventorySlot existingSlot = items.Find(slot => slot.item.itemName == item.itemName);
-
if (existingSlot != null && item.isStackable)
{
+ //Add to existing stack
if (existingSlot.quantity + quantity <= item.maxStackSize)
{
existingSlot.quantity += quantity;
- return true;
}
else
{
int remainingQuantity = item.maxStackSize - existingSlot.quantity;
existingSlot.quantity = item.maxStackSize;
- return AddItem(item, quantity - remainingQuantity);
+ //TODO: Show inventory overflow message
+ Debug.Log("Inventory overflow");
+ existingSlot.quantity += remainingQuantity;
}
+
}
else
{
- if (items.Count < maxInventorySize)
- {
- items.Add(new InventorySlot(item, quantity));
- return true;
- }
- return false;
+ //Add new item to inventory
+ items.Add(new InventorySlot(item, quantity));
}
+ GameStateEvents.inventoryChanged?.Invoke();
+ return true;
}
public void RemoveItem(Item item, int quantity = 1)
@@ -67,6 +71,7 @@
items.Remove(existingSlot);
}
}
+ GameStateEvents.inventoryChanged?.Invoke();
}
}
diff --git a/Assets/Scripts/Inventory/InventoryDisplay.cs b/Assets/Scripts/Inventory/InventoryDisplay.cs
new file mode 100644
index 0000000..7ca2098
--- /dev/null
+++ b/Assets/Scripts/Inventory/InventoryDisplay.cs
@@ -0,0 +1,163 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using TMPro;
+using UnityEngine;
+using UnityEngine.InputSystem;
+using UnityEngine.UI;
+
+public class InventoryDisplay : MonoBehaviour
+{
+ private GameObject _playerGO;
+ private Inventory inventory;
+ public GameObject inventoryPanel;
+ public GameObject itemContent;
+ public GameObject itemUIPrefab;
+
+ public List<GameObject> itemUIs = new List<GameObject>();
+
+ public GameObject PlayerGO
+ {
+ get
+ {
+ if (_playerGO == null)
+ {
+ _playerGO = GameObject.Find("Player");
+ }
+ return _playerGO;
+ }
+ private set { _playerGO = value; }
+ }
+
+ private void Awake()
+ {
+ PlayerGO = GameObject.Find("Player");
+ inventory = _playerGO.GetComponent<Inventory>();
+ //originalRect = healthImage.rectTransform.rect;
+ }
+ private void OnEnable()
+ {
+ GameStateEvents.inventoryChanged += UpdateItemContentList;
+ }
+ private void OnDisable()
+ {
+ GameStateEvents.inventoryChanged -= UpdateItemContentList;
+ }
+
+
+ public void OnInventoryButtonPressed(InputAction.CallbackContext context)
+ {
+ //TODO: Delete this
+ //if (context.started)
+ //{
+ // ResumeOrPauseGame(GameManager.GameIsPaused);
+ //}
+ if (context.started)
+ {
+ inventoryPanel.SetActive(!inventoryPanel.activeSelf);
+ if (inventoryPanel.activeSelf)
+ {
+ GenerateItemContentList();
+ }
+ else
+ {
+ ClearItemContentList();
+ }
+ }
+ }
+
+ //TODO: Delete this
+ //private void ResumeOrPauseGame(bool resume)
+ //{
+ // if (resume)
+ // {
+ // ResumeWithMenu();
+ // }
+ // else
+ // {
+ // PauseWithMenu();
+ // }
+ //}
+
+
+ //TODO: Delete this
+ //private void ResumeWithMenu()
+ //{
+ // GameManager.ResumeGame();
+ // inventoryPanel.SetActive(false);
+ // ClearItemContentList();
+ //}
+
+ //TODO: Delete this
+ //private void PauseWithMenu()
+ //{
+ // GameManager.PauseGame();
+ // inventoryPanel.SetActive(true);
+ // GenerateItemContentList();
+ //}
+
+ private void GenerateItemContentList()
+ {
+ inventory.items?.ForEach(slot =>
+ {
+ GameObject itemUI = Instantiate(itemUIPrefab, itemContent.transform);
+ itemUI.transform.Find("ItemName").GetComponent<TextMeshProUGUI>().text = slot.item.itemName;
+ itemUI.transform.Find("ItemQuantity").GetComponent<TextMeshProUGUI>().text = slot.quantity.ToString() + "x";
+ itemUI.transform.Find("ItemIcon").GetComponent<Image>().sprite = slot.item.itemIcon;
+ itemUIs.Add(itemUI);
+ });
+ }
+
+ private void UpdateItemContentList()
+ {
+ // First, deactivate all existing itemUIs
+ itemUIs.ForEach(itemUI => itemUI.SetActive(false));
+
+ // Keep track of which UI elements we've used
+ int currentIndex = 0;
+
+ inventory.items.ForEach(slot =>
+ {
+ GameObject itemUI;
+
+ // Reuse existing UI element if available
+ if (currentIndex < itemUIs.Count)
+ {
+ itemUI = itemUIs[currentIndex];
+ itemUI.SetActive(true);
+ }
+ else
+ {
+ // Create new UI element if needed
+ itemUI = Instantiate(itemUIPrefab, itemContent.transform);
+ itemUIs.Add(itemUI);
+ }
+
+ // Update the UI elements
+ itemUI.transform.Find("ItemName").GetComponent<TextMeshProUGUI>().text = slot.item.itemName;
+ itemUI.transform.Find("ItemQuantity").GetComponent<TextMeshProUGUI>().text = slot.quantity.ToString() + "x";
+ itemUI.transform.Find("ItemIcon").GetComponent<Image>().sprite = slot.item.itemIcon;
+
+ currentIndex++;
+ });
+
+ // Remove any excess UI elements
+ if (currentIndex < itemUIs.Count)
+ {
+ for (int i = itemUIs.Count - 1; i >= currentIndex; i--)
+ {
+ Destroy(itemUIs[i]);
+ itemUIs.RemoveAt(i);
+ }
+ }
+ }
+
+ private void ClearItemContentList()
+ {
+ itemUIs.ForEach(itemUI =>
+ {
+ Destroy(itemUI);
+ });
+ itemUIs.Clear();
+ }
+}
diff --git a/Assets/Scripts/Inventory/InventoryDisplay.cs.meta b/Assets/Scripts/Inventory/InventoryDisplay.cs.meta
new file mode 100644
index 0000000..ae00741
--- /dev/null
+++ b/Assets/Scripts/Inventory/InventoryDisplay.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 83ed442b2279fb147b128b439a8c63aa
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs
index 83a4f31..e0670dd 100644
--- a/Assets/Scripts/Managers/GameManager.cs
+++ b/Assets/Scripts/Managers/GameManager.cs
@@ -10,6 +10,8 @@
public class GameManager : SettingsManager
{
+ public static bool GameIsPaused = false;
+
public GameObject damageTextPrefab;
public GameObject healthTextPrefab;
public Canvas playerUI;
@@ -24,6 +26,7 @@
private void Awake()
{
+ GameIsPaused = false;
SoundManager.instance.ChangeMusic(SoundName.MusicHappy);
LoadTileMaps(SaveSystem.isGameLoaded);
}
@@ -32,7 +35,7 @@
private void LoadTileMaps(bool loadFromSave)
{
generateTileMap = tilemap.GetComponent<GenerateTileMap>();
- pauseMenuUI.GetComponent<PauseMenu>().Pause();
+ PauseGame();
levelChanger.GetComponent<Animator>().SetBool("SceneLoading", true);
if (loadFromSave)
{
@@ -67,7 +70,7 @@
}
public void GameLoaded()
{
- pauseMenuUI.GetComponent<PauseMenu>().Resume();
+ ResumeGame();
pauseMenuUI.GetComponent<Animator>().SetTrigger("GameLoaded");
}
@@ -140,9 +143,12 @@
if (tileGameObject?.GetComponent<Dropable>()?.isDropable ?? false)
{
// Change no drops, only inventory
- Instantiate(tileGameObject?.GetComponent<Dropable>().dropable, cellWorldPosition, Quaternion.identity, pickups.transform);
- //Debug.Log(.name);
-
+ //Instantiate(tileGameObject?.GetComponent<Dropable>().dropable, cellWorldPosition, Quaternion.identity, pickups.transform);
+ Inventory playerInventory = contact.rigidbody.gameObject.GetComponent<Inventory>();
+ if (playerInventory != null)
+ {
+ playerInventory.AddItem(tileGameObject?.GetComponent<Dropable>().dropable);
+ }
}
tilemap.SetTile(cellCoord, null);
destroyedTiles.Add(cellCoord);
@@ -156,4 +162,20 @@
}
#endregion
+
+ #region GameState
+
+ public static void PauseGame()
+ {
+ Time.timeScale = 0f;
+ GameIsPaused = true;
+ //GameStateEvents.gameStatePauseChanged.Invoke(GameIsPaused);
+ }
+ public static void ResumeGame()
+ {
+ Time.timeScale = 1f;
+ GameIsPaused = false;
+ //GameStateEvents.gameStatePauseChanged.Invoke(GameIsPaused);
+ }
+ #endregion
}
diff --git a/Assets/Scripts/PauseMenu.cs b/Assets/Scripts/PauseMenu.cs
index 630aa70..7227f6f 100644
--- a/Assets/Scripts/PauseMenu.cs
+++ b/Assets/Scripts/PauseMenu.cs
@@ -7,7 +7,6 @@
public class PauseMenu : MonoBehaviour
{
- public static bool GameIsPaused = false;
public GameObject pauseMenuUI;
public GameObject settingsMenuUI;
@@ -18,14 +17,13 @@
private void Awake()
{
animator = GetComponent<Animator>();
- GameIsPaused = false;
}
public void OnEscapedPressed(InputAction.CallbackContext context)
{
if (context.started)
{
- ResumeOrPauseGame(GameIsPaused);
+ ResumeOrPauseGame(GameManager.GameIsPaused);
}
}
@@ -43,32 +41,22 @@
private void ResumeWithMenu()
{
- // TODO make it dynamic (whichever UI is activ set it to falsen when unpaused)
+ // TODO make it dynamic (whichever UI is activ set it to false when unpaused)
+ GameManager.ResumeGame();
pausePanel.SetActive(false);
- Resume();
- }
- public void Resume()
- {
- Time.timeScale = 1f;
- GameIsPaused = false;
}
private void PauseWithMenu()
{
+ GameManager.PauseGame();
settingsMenuUI.SetActive(false);
pauseMenuUI.SetActive(true);
pausePanel.SetActive(true);
- Pause();
- }
- public void Pause()
- {
- Time.timeScale = 0f;
- GameIsPaused = true;
}
public void OnResumeClicked()
{
- Resume();
+ GameManager.ResumeGame();
}
public void OnGameSaveClicked()
@@ -97,7 +85,7 @@
public void OnExitClicked()
{
- Resume();
+ GameManager.ResumeGame();
SceneManager.LoadScene("MainMenu");
}
diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs
index 4447e1b..406f720 100644
--- a/Assets/Scripts/PlayerController.cs
+++ b/Assets/Scripts/PlayerController.cs
@@ -136,7 +136,7 @@
{
get
{
- return animator.GetBool(AnimationStrings.canMove) && !PauseMenu.GameIsPaused && !IsDrilling;
+ return animator.GetBool(AnimationStrings.canMove) && !GameManager.GameIsPaused && !IsDrilling;
}
}
diff --git a/Assets/TileSets/Palettes/DrillIronOre.prefab b/Assets/TileSets/Palettes/DrillIronOre.prefab
index a1c226e..bec7d18 100644
--- a/Assets/TileSets/Palettes/DrillIronOre.prefab
+++ b/Assets/TileSets/Palettes/DrillIronOre.prefab
@@ -59,4 +59,4 @@
m_Name:
m_EditorClassIdentifier:
isDropable: 1
- dropable: {fileID: 2334861655815823944, guid: cd5330e6f2360684bbdaec64d8423c1d, type: 3}
+ dropable: {fileID: 7215668260114684477, guid: ead8eea59ce41c244814a994365e1129, type: 3}
diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset
index 70f1ea2..264dd27 100644
--- a/ProjectSettings/EditorBuildSettings.asset
+++ b/ProjectSettings/EditorBuildSettings.asset
@@ -14,4 +14,5 @@
- enabled: 0
path: Assets/Scenes/LoadingScene.unity
guid: 196356abeef14804ca19d775065d69ce
- m_configObjects: {}
+ m_configObjects:
+ com.unity.input.settings: {fileID: 11400000, guid: 7e04de496fcdd9940a7686f07b3ded72, type: 2}
--
Gitblit v1.10.0