The biggest difference between a composite node and a decorator node is that a decorator can have exactly one child, and one child only. At first, this may seem unnecessary as you would, in theory, be able to get the same functionality by containing the condition in the node itself rather than relying on its child, but the decorator node is special in that it essentially takes the state returned by the child and evaluates the response based on its own parameters. A decorator can even specify how its children are evaluated and how often they are evaluated. These are some common decorator types:
- Inverter: Think of the inverter as a NOT modifier. It takes the opposite of the state returned by its child. For example, ...