public void UpdateState() { if (PlayerData.unlockMessage != null) { //Debug.Log("Key: " + m_Key + " Contains Key: " + PlayerData.unlockMessage.unlocks.ContainsKey(m_Key)); if (PlayerData.unlockMessage.unlocks.ContainsKey(m_Key) == false) { transform.parent.gameObject.SetActive(false); } else { transform.parent.gameObject.SetActive(true); UnlockItem ui = PlayerData.unlockMessage.unlocks[m_Key]; if (ui.unlocked) { _button.interactable = true; } else { _button.interactable = false; } } } else { transform.parent.gameObject.SetActive(false); } }
private void AddUnlock(UnlockItem unlockItem) { if (_unlockedItems[unlockItem.UnlockType].Contains(unlockItem)) { throw new InvalidOperationException($"Character has already unlocked {unlockItem}."); } _unlockedItems[unlockItem.UnlockType].Add(unlockItem); }
private void RemoveUnlock(UnlockItem unlockItem) { if (!_unlockedItems[unlockItem.UnlockType].Contains(unlockItem)) { throw new InvalidOperationException($"Character has not unlocked {unlockItem} yet."); } _unlockedItems[unlockItem.UnlockType].Remove(unlockItem); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { //Debug.Log("Game Done"); if (shouldUnlockSomething) { foreach (Unlockables item in itemToUnlock) { UnlockItem.UnlockItems(item); } } GameSave.GetGameSave().CompletedLevel(); //GameManager.ChangeGameState(GameStateScriptableObject.GameState.levelComplete); GameManager.RequestGameStateChange(GameStateScriptableObject.GameState.levelComplete); } }
public bool HasUnlocked(UnlockItem unlockItem) => _unlockedItems[unlockItem.UnlockType].Contains(unlockItem);