added Hoe & Scythe Items
added starting Items in Inventory
This commit is contained in:
parent
207d07b026
commit
db13c25920
3 changed files with 43 additions and 6 deletions
19
Assets/Items/Usable/Hoe.asset
Normal file
19
Assets/Items/Usable/Hoe.asset
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
%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: 761f645f009328845bc7851753024e92, type: 3}
|
||||||
|
m_Name: Hoe
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
displayName: Hoe
|
||||||
|
description: on the streets
|
||||||
|
id: 0
|
||||||
|
selectedSprite: {fileID: 21300238, guid: 2700e06d970d112489ff23cfb58c3f78, type: 3}
|
||||||
|
defaultSprite: {fileID: 21300212, guid: 2700e06d970d112489ff23cfb58c3f78, type: 3}
|
||||||
19
Assets/Items/Usable/Scythe.asset
Normal file
19
Assets/Items/Usable/Scythe.asset
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
%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: 761f645f009328845bc7851753024e92, type: 3}
|
||||||
|
m_Name: Scythe
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
displayName: Scythe
|
||||||
|
description: better than in stardew valley
|
||||||
|
id: 1
|
||||||
|
selectedSprite: {fileID: 21300234, guid: 2700e06d970d112489ff23cfb58c3f78, type: 3}
|
||||||
|
defaultSprite: {fileID: 21300208, guid: 2700e06d970d112489ff23cfb58c3f78, type: 3}
|
||||||
|
|
@ -19,6 +19,7 @@ public class Inventory : MonoBehaviour {
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public Dictionary<Item, int> items;
|
public Dictionary<Item, int> items;
|
||||||
|
public Item[] startItems;
|
||||||
public const int inventorySpace = 28;
|
public const int inventorySpace = 28;
|
||||||
|
|
||||||
public delegate void onItemChanged();
|
public delegate void onItemChanged();
|
||||||
|
|
@ -26,13 +27,11 @@ public class Inventory : MonoBehaviour {
|
||||||
|
|
||||||
private void Start() {
|
private void Start() {
|
||||||
items ??= new Dictionary<Item, int>();
|
items ??= new Dictionary<Item, int>();
|
||||||
|
foreach(Item item in startItems) {
|
||||||
|
AddItem(item, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tempAddItem(Item item) {
|
|
||||||
Debug.Log("AWSD");
|
|
||||||
AddItem(item, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddItem(Item item, int amount) {
|
public void AddItem(Item item, int amount) {
|
||||||
if(items.Count >= inventorySpace) {
|
if(items.Count >= inventorySpace) {
|
||||||
Debug.Log("Not enough inventory space!");
|
Debug.Log("Not enough inventory space!");
|
||||||
|
|
@ -51,7 +50,7 @@ public class Inventory : MonoBehaviour {
|
||||||
onItemChangedCallback?.Invoke();
|
onItemChangedCallback?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeItem(Item item, int amount) {
|
public void RemoveItem(Item item, int amount) {
|
||||||
items.Add(item, -amount);
|
items.Add(item, -amount);
|
||||||
|
|
||||||
onItemChangedCallback?.Invoke();
|
onItemChangedCallback?.Invoke();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue