Exemple #1
0
    void SetupTokens()
    {
        conditionToken = GameObject.Instantiate <UIRuleConditionToken>(conditionPrefab, Vector3.zero, Quaternion.identity, contentRoot);
        conditionToken.Setup(workingRule, workingRule.condition);
        conditionToken.onConditionChanged += OnConditionChange;
        for (int i = 0; i < workingRule.actions.Count; ++i)
        {
            var action = workingRule.actions[i];
            AddActionToken(action, i == 0);
        }

        addActionButton.transform.SetAsLastSibling();
    }
Exemple #2
0
 void ClearTokens()
 {
     if (conditionToken != null)
     {
         conditionToken.onConditionChanged -= OnConditionChange;
         GameObject.Destroy(conditionToken.gameObject);
         conditionToken = null;
     }
     foreach (var actionToken in actionTokens)
     {
         actionToken.onActionChanged -= OnActionChange;
         GameObject.Destroy(actionToken.gameObject);
     }
     actionTokens.Clear();
 }