void Start() { _controller = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController) .GetComponent <CollectionSystem>(); Sprite[] icons = Resources.LoadAll <Sprite>("Icons"); for (int i = 0; i < icons.Length; i++) { try { Collectable.Tag parsedTag = (Collectable.Tag)System.Enum.Parse(typeof(Collectable.Tag), icons[i].name); _icons[parsedTag] = icons[i]; } catch { Debug.LogWarning(icons[i].name + " has no enumerable on Collectable.Tag :("); } } for (int i = 0; i < Slots.Count; i++) { Slots[i].Index = i; } Refresh(); }
public void SetSprite(Sprite sprite, Collectable.Tag tag) { if (Icon == null) { Icon = GetComponent <Image>(); } Icon.sprite = sprite; _tag = tag; }
public void RegisterAsTaken(Collectable.Tag collectable) { Debug.Log("taken: " + collectable); _takenStuff[collectable] = true; if (false == Inventory.Contains(collectable)) { Inventory.Add(collectable); } UIController.Refresh(); }
public bool HasItem(Collectable.Tag item) { foreach (Collectable.Tag ownedItem in Inventory) { if (item == ownedItem) { return(true); } } return(false); }
private int _IndexOfRequirement(Collectable.Tag requirement) { for (int i = 0; i < UnmetRequirements.Count; i++) { if (UnmetRequirements[i].Name == requirement) { return(i); } } return(-1); }
// needs refactorization public bool TryToTakeRequirement(Collectable.Tag requirement) { // int i = UnmetRequirements.IndexOf(requirement); int i = _IndexOfRequirement(requirement); if (i >= 0) { _receibedDialogueIndex = UnmetRequirements[i].IndexOfDialogue; TheTalkable.SetDialogueIndex(_receibedDialogueIndex); _controller.RegisterAsGiven(requirement); UnmetRequirements.RemoveAt(i); TheTalkable.IsForcedToTalk = true; return(true); } return(false); }
public void RegisterAsGiven(Collectable.Tag collectable) { _givenStuff[collectable] = true; Inventory.Remove(collectable); UIController.Refresh(); }
public PersistedCollectable(bool isTaken, Collectable.Tag name) { IsTaken = isTaken; Name = name; }
public void ShowInventoryLabel(Collectable.Tag tag) { InventoryLabel.SetActive(true); InventoryLabel.GetComponent <Text>().text = _names[tag]; }