﻿public class Conditional : DecoratorTask {
    private ConditionalDelegate conditionalDelegate;

    public Conditional(string name, ConditionalDelegate conditionalDelegate) : base(name)
    {
        this.conditionalDelegate = conditionalDelegate;
    }

    public override ReturnCode Update()
    {
        var value = conditionalDelegate();
        if (value)
        {
            return ReturnCode.Succeed;
        }
        else
        {
            return ReturnCode.Fail;
        }
    }
}

public delegate bool ConditionalDelegate();
﻿public class Conditional : Task {
    private ConditionalDelegate conditionalDelegate;

    public Conditional(string name, ConditionalDelegate conditionalDelegate) : base(name)
    {
        this.conditionalDelegate = conditionalDelegate;
    }

    public override ReturnCode Update()
    {
        var value = conditionalDelegate();
        if (value)
        {
            return ReturnCode.Succeed;
        }
        else
        {
            return ReturnCode.Fail;
        }
    }
}

public delegate bool ConditionalDelegate();
Change conditional from decorator to a task
Change conditional from decorator to a task
