File tree Expand file tree Collapse file tree 1 file changed +53
-1
lines changed Expand file tree Collapse file tree 1 file changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -167,15 +167,67 @@ Runs all child nodes at the same time until they all return *Success*. Exits and
167167
168168### Decorators
169169
170+ Decorators are parent elements that wrap any node to change the return value (or execute special logic). They are
171+ extremely powerful and a great compliment to actions, conditions, and composites.
172+
170173#### Generic
171174
175+ You can wrap any node with your own custom decorator code. This allows you to customize re-usable functionality.
176+
177+ * NOTE* : You must manually call ` Update() ` on the child node or it will not fire.
178+
179+ ``` C#
180+ .Sequence ()
181+ .Decorator (" Return Success" , child => {
182+ child .Update ();
183+ return TaskStatus .Success ;
184+ })
185+ .Do (() => { return TaskStatus .Failure ; })
186+ .End ()
187+ .Do (() => { return TaskStatus .Success ; })
188+ .End ()
189+ ```
190+
172191#### Inverter
173192
193+ Reverse the returned status of the child node if it's ` TaskStatus.Success ` or ` TaskStatus.Failure ` .
194+ Does not change ` TaskStatus.Continue ` .
195+
196+ ``` C#
197+ .Sequence ()
198+ .Inverter ()
199+ .Do (() => { return TaskStatus .Success ; })
200+ .End ()
201+ .End ()
202+ ```
203+
174204#### ReturnSuccess
175205
206+ Return ` TaskStatus.Success ` if the child returns ` TaskStatus.Failure ` .
207+ Does not change ` TaskStatus.Continue ` .
208+
209+ ``` C#
210+ .Sequence ()
211+ .ReturnSuccess ()
212+ .Do (() => { return TaskStatus .Failure ; })
213+ .End ()
214+ .End ()
215+ ```
216+
176217#### ReturnFailure
177218
178- ## Creating your own custom nodes
219+ Return ` TaskStatus.Failure ` if the child returns ` TaskStatus.Success ` .
220+ Does not change ` TaskStatus.Continue ` .
221+
222+ ``` C#
223+ .Sequence ()
224+ .ReturnFailure ()
225+ .Do (() => { return TaskStatus .Success ; })
226+ .End ()
227+ .End ()
228+ ```
229+
230+ ## Creating custom re-usable nodes
179231
180232### Actions
181233
You can’t perform that action at this time.
0 commit comments