-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Logica do sistema de salvamento(Em andamento)
Logica do sistema de salvamento(Em andamento)
- Loading branch information
1 parent
e638b33
commit 71a1676
Showing
8 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.