예제 #1
0
 public void TryToUnlockAllNodes()
 {
     for (int i = 0; i < Graph.Count; i++)
     {
         var prev    = Graph[i].IsAvailable;
         var current = Graph[i].TryToUnlock(CurrentProgress);
         if (current != prev)
         {
             OnNodeChanged?.Invoke(Graph[i]);
             OnValueChanged?.Invoke();
         }
     }
 }
예제 #2
0
        public void IncreaseNodeLevel(Node _node)
        {
            if (_node == null)
            {
                throw new Exception("Node doesnt exist");
            }
            if (!_node.TryToUnlock(CurrentProgress))
            {
                Debug.LogError("Can't learn node yet"); return;
            }
            if (_node.Level >= _node.MaxLevel)
            {
                Debug.LogError("Node is already at max level"); return;
            }

            _node.IncreaseLevel();
            OnNodeChanged?.Invoke(_node);
            OnValueChanged?.Invoke();
            TryToUnlockAllNodes();
            return;
        }
예제 #3
0
 protected virtual void InvokeOnStatusChanged(Node _node)
 {
     OnNodeChanged?.Invoke(_node);
 }
예제 #4
0
 public void SetCurrentNode(NodeBehaviour node)
 {
     currentNode = node;
     OnNodeChanged.Invoke(currentNode);
 }