Exemple #1
0
    void SetConditionType(Behaviors.ConditionType newType)
    {
        if (newType != editCondition.type)
        {
            onConditionChanged?.Invoke(parentRule, editCondition);

            // Change the type, which really means create a new condition and replace the old one
            var newCondition = Behaviors.EditCondition.Create(newType);

            // Replace the condition
            parentRule.condition = newCondition;

            // Setup the parameters again
            foreach (var parameter in parameters.parameters)
            {
                GameObject.Destroy(parameter.gameObject);
            }
            parameters = UIParameterManager.Instance.CreateControls(newCondition, parametersRoot);
            parameters.onParameterChanged += OnConditionChanged;

            editCondition = newCondition;

            onConditionChanged?.Invoke(parentRule, editCondition);
        }
    }
Exemple #2
0
    public void Setup(Behaviors.EditRule rule, Behaviors.EditCondition condition)
    {
        parentRule    = rule;
        editCondition = condition;
        conditionSelector.Setup(
            "Condition Type",
            () => editCondition.type,
            (t) => SetConditionType((Behaviors.ConditionType)t),
            null);

        // Setup all other parameters
        parameters = UIParameterManager.Instance.CreateControls(condition, parametersRoot);
        parameters.onParameterChanged += OnConditionChanged;
    }
Exemple #3
0
 public abstract void Setup(Behaviors.EditCondition condition);