Пример #1
0
    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);
        }
    }
Пример #2
0
        private void AddUnlock(UnlockItem unlockItem)
        {
            if (_unlockedItems[unlockItem.UnlockType].Contains(unlockItem))
            {
                throw new InvalidOperationException($"Character has already unlocked {unlockItem}.");
            }

            _unlockedItems[unlockItem.UnlockType].Add(unlockItem);
        }
Пример #3
0
        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);
        }
Пример #4
0
 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);
     }
 }
Пример #5
0
 public bool HasUnlocked(UnlockItem unlockItem) => _unlockedItems[unlockItem.UnlockType].Contains(unlockItem);