private void RemoveInternal(GoalBase goal) { if (!isActiveAndEnabled) { return; } if (m_Goals == null) { return; } List <GoalBase> list; if (!m_Goals.TryGetValue(goal.Title, out list)) { return; } if (list.Remove(goal)) { if (list.Count == 0) { m_Goals.Remove(goal.Title); } goal.GoalStateChanged -= HandleGoalChanged; OnGoalsChangedInternal(); } }
public static void Remove(GoalBase goal) { if (s_Instance != null) { s_Instance.RemoveInternal(goal); } }
private void AddInternal(GoalBase goal) { if (!isActiveAndEnabled) { return; } if (m_Goals == null) { m_Goals = new Dictionary <string, List <GoalBase> >(); } List <GoalBase> list; if (!m_Goals.TryGetValue(goal.Title, out list)) { list = new List <GoalBase>(); m_Goals.Add(goal.Title, list); } if (list.Contains(goal)) { return; } list.Add(goal); goal.GoalStateChanged += HandleGoalChanged; OnGoalsChangedInternal(); }
public static void Add(GoalBase goal) { if (s_Instance != null) { s_Instance.AddInternal(goal); } }