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(); } } }
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; }
protected virtual void InvokeOnStatusChanged(Node _node) { OnNodeChanged?.Invoke(_node); }
public void SetCurrentNode(NodeBehaviour node) { currentNode = node; OnNodeChanged.Invoke(currentNode); }