active-logic / activelogic-cs

Behavior Trees and Case Logic for C#7
GNU Affero General Public License v3.0
106 stars 7 forks source link

Seq() in Seq() does not repeat #84

Closed dherault closed 2 years ago

dherault commented 2 years ago

Hi, Pro-user and contributor here.

If we look at the following:

        public override status Step()
        {
            return Eval(
                Seq(false)
                    + @do?[Task1()]
                    + @do?[Seq(true) + @do?[Task2()]]
                && done()
            );
        }

We find that Task2 is called only once, even if Seq(true).

I am missing something? Best,

dherault commented 2 years ago

Found a solution:

        public override status Step()
        {
            return Eval(
                Seq(false)
                    + @do?[Task1()]
                    + @do?[(Seq(true) + @do?[Task2()]) && cont()]
                && done()
            );
        }

Hope this helps another one to figure out nested sequences.