Skip to content

Commit

Permalink
Logica do sistema de salvamento(Em andamento)
Browse files Browse the repository at this point in the history
Logica do sistema de salvamento(Em andamento)
  • Loading branch information
sousaawesley authored Jul 18, 2024
1 parent e638b33 commit 71a1676
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Assets/Scripts/Item/InventoryManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InventoryManager : MonoBehaviour
{
public static InventoryManager Instance;
public List<Item> Items = new List<Item>();
private void Awake()
{
Instance = this;
}

public void Add(Item item)
{
Items.Add(item);
}

public void Remove(Item item)
{
Items.Remove(item);
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Item/InventoryManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Assets/Scripts/Item/Item.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "New Item", menuName = "Item/Create New Item")]
public class Item : ScriptableObject
{
public int id;
public string itemName;
public int value;
public Sprite icon;
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Item/Item.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Scripts/Item/ItemController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ItemController : MonoBehaviour
{
public Item Item;
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Item/ItemController.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Assets/Scripts/Item/ItemPickup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ItemPickup : MonoBehaviour
{
public Item Item;
void Pickup()
{
InventoryManager.Instance.Add(Item);
Destroy(gameObject);
}


private void OnMouseDown()
{
Pickup();
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Item/ItemPickup.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 71a1676

Please sign in to comment.