Skip to content

Commit

Permalink
Agora os itens coletados aparecem na galeria
Browse files Browse the repository at this point in the history
Faltam ajustes como: zerar toda vez que se reseta o save (opcao que foi retirada diga-ee de passagem).
Falta adicionar alguns itens, acho.
  • Loading branch information
TanookiVerde committed Sep 8, 2017
1 parent 11ac0d9 commit a3ca8ab
Show file tree
Hide file tree
Showing 26 changed files with 92 additions and 1 deletion.
Binary file modified Assets/_scenes/_mainScene.unity
Binary file not shown.
Binary file modified Assets/_scenes/_newMenu.unity
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/code/items/Gem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;

public class Gem : MonoBehaviour, IItem {
[SerializeField] private SOGem gemData;
public SOGem gemData;

public void Effect(){
return;
Expand Down
2 changes: 2 additions & 0 deletions Assets/code/items/ItemCatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

public class ItemCatcher : MonoBehaviour {
LevelManager lManager;
[SerializeField] private SO_PlayerData playerData;

private void Start(){
lManager = GameObject.Find("LevelManager").GetComponent<LevelManager>();
Expand All @@ -21,6 +22,7 @@ private void NewGem(GameObject gem){
IItem item = gem.GetComponent<IItem>();
item.Destroy();
lManager.collectedItems.Add(gem.gameObject);
playerData.collectedItems[gem.GetComponent<Gem>().gemData.itemType.GetHashCode()] = true;
lManager.totalMoney += item.GetValue();
StartCoroutine ( lManager.UpdateMoneyText() );
}
Expand Down
19 changes: 19 additions & 0 deletions Assets/code/items/TreasureList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TreasureList : MonoBehaviour {

[SerializeField] private SO_PlayerData _playerData;
[SerializeField] private List<GameObject> _itemList;

private void Start(){
int total = _itemList.Count;
print(total);
for(int i = 0;i<total;i++){
_itemList[i].GetComponent<Selectable>().interactable = _playerData.collectedItems[i];
print("i: "+i+"item: "+_playerData.collectedItems[i]);
}
}
}
12 changes: 12 additions & 0 deletions Assets/code/items/TreasureList.cs.meta

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

9 changes: 9 additions & 0 deletions Assets/code/muquirana/SO_PlayerData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(menuName = "Custom/PlayerData")]
public class SO_PlayerData : ScriptableObject {
const int itemQuantity = 20;
public bool[] collectedItems = new bool[itemQuantity];
}
12 changes: 12 additions & 0 deletions Assets/code/muquirana/SO_PlayerData.cs.meta

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

Binary file added Assets/code/scriptable/PlayerData.asset
Binary file not shown.
9 changes: 9 additions & 0 deletions Assets/code/scriptable/PlayerData.asset.meta

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

4 changes: 4 additions & 0 deletions Assets/code/scriptable/SOGem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using UnityEditor;
#endif

public enum ItemType{
ANEL,BAU,BRACELETE,BRINCO, BROCHE, CALICE,CINTO,ESPELHO,LIVRO,MOEDA,PRENDEDOR,PULSEIRA,URNA
}
[CreateAssetMenu(menuName = "Custom/GemModel")]
public class SOGem : ScriptableObject {
[Header("Properties")]
Expand All @@ -13,4 +16,5 @@ public class SOGem : ScriptableObject {
[SerializeField] public string description;
[Range(0,1)]
[SerializeField] public float ratio;
public ItemType itemType;
}
Binary file modified Assets/code/scriptable/items/gem_Bau.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Bracelete.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Brinco.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Broche.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Calice.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Cinto.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Espelho.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Livro.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Moeda.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Prendedor.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Pulseira.asset
Binary file not shown.
Binary file modified Assets/code/scriptable/items/gem_Urna.asset
Binary file not shown.
12 changes: 12 additions & 0 deletions Assets/code/ui/New Menu/NewMenu/GalleryItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class GalleryItem : MonoBehaviour {

public void ShowDescription(){
GameObject.Find("Text_Box").transform.GetChild(0).GetComponent<Text>().text = GetComponent<Gem>().gemData.name;
GameObject.Find("Text_Box").transform.GetChild(1).GetComponent<Text>().text = GetComponent<Gem>().gemData.description;
}
}
12 changes: 12 additions & 0 deletions Assets/code/ui/New Menu/NewMenu/GalleryItem.cs.meta

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

Binary file modified Assets/prefabs/ui/Items_Gallery/Item_Box.prefab
Binary file not shown.

0 comments on commit a3ca8ab

Please sign in to comment.