private void HandleTargetChecked(ChainNode target, bool isChecked) { // This is setting actual targets in the state. if (isChecked && !SelectionState.Contains(target)) { SelectionState.AddTarget(target); } else if (!isChecked && SelectionState.Contains(target)) { SelectionState.RemoveTarget(target); } }
private void CreateTargetCheckbox(ChainNode target) { var newTargetItemGo = Instantiate(TargetUiPrefab); var newTargetItem = newTargetItemGo.GetComponent <StateRouterTargetCheckboxView>(); newTargetItem.transform.SetParent(TargetItemRootTransform, false); if (SelectionState != null && SelectionState.Contains(target)) { newTargetItem.Checked = true; } newTargetItem.CheckedChanged += isChecked => HandleTargetChecked(target, isChecked); TargetsToTargetCheckboxes.Add(target, newTargetItem); }