Observer Decorator

Type description and basic instructions.

Description

Observer Decorator is base abstract class for all decorator nodes that are supposed to continiously observe certain key values.

To create a custom observer decorator you should inherit from Observer Decorator class and implement logic that is described below.

CalculateResult and OnValueChange

When inheriting from Observer Decorator you have to override CalculateResult method and OnValueChange event.

public class ExampleObserverDecorator : ObserverDecorator
{
    public override bool CalculateResult()
    {
        throw new NotImplementedException();
    }

    public override event Action OnValueChange;
}
  • Calculate result calculates the observed value of the result.

  • CalculateResult gets called every tick during node execution.

  • OnValueChanged gets called when the observed key value changes.

Observer Decorator inherits from Decorator Node

To create custom decorator nodes in editor you should add Node Content attribute to your custom decorator node class.

Last updated