//--------------------------------------------------------------------- // executes the behavior after a given amount of time in miliseconds has passed // <param name="elapsedTimeFunction">function that returns elapsed time</param> // <param name="timeToWait">maximum time to wait before executing behavior</param> // <param name="behavior">behavior to run</param> public DecoratorTimer(BehaviorTree bt, Func<int> func_elapsedtm, int wait_tm, BehaviorComponent behavior) : base(bt) { mFuncElapsedTm = func_elapsedtm; mBehavior = behavior; mWaitTime = wait_tm; }
//--------------------------------------------------------------------- // Selects among the given behavior components (stateful on running) // Performs an OR-Like behavior and will "fail-over" to each successive component until Success is reached or Failure is certain // -Returns Success if a behavior component returns Success // -Returns Running if a behavior component returns Running // -Returns Failure if all behavior components returned Failure public StatefulSelector(BehaviorTree bt, params BehaviorComponent[] behaviors) : base(bt) { this._Behaviors = behaviors; }
//--------------------------------------------------------------------- // executes the behavior based on a counter // -each time Counter is called the counter increments by 1 // -Counter executes the behavior when it reaches the supplied maxCount public DecoratorCounter(BehaviorTree bt, int max_count, BehaviorComponent behavior) : base(bt) { mMaxCount = max_count; mBehavior = behavior; }
//--------------------------------------------------------------------- public Action1(BehaviorTree bt, Func<BehaviorTree, object[], BehaviorReturnCode> action, params object[] list_param) : base(bt) { mAction = action; mListParam = list_param; }
//--------------------------------------------------------------------- // inverts the given behavior // -Returns Success on Failure or Error // -Returns Failure on Success // -Returns Running on Running public DecoratorInverter(BehaviorTree bt, BehaviorComponent behavior) : base(bt) { mBehavior = behavior; }
//--------------------------------------------------------------------- // Returns a return code equivalent to the test // -Returns Success if true // -Returns Failure if false // <param name="test">the value to be tested</param> public Conditional(BehaviorTree bt, Func<BehaviorTree, object[], Boolean> func_bool, params object[] list_param) : base(bt) { mFuncBool = func_bool; mListParam = list_param; }
//--------------------------------------------------------------------- public Action2(BehaviorTree bt) : base(bt) { }
//--------------------------------------------------------------------- public BehaviorComponent(BehaviorTree bt) { mBehaviorTree = bt; }
//--------------------------------------------------------------------- // The selector for the root node of the behavior tree // <param name="index">an index representing which of the behavior branches to perform</param> // <param name="behaviors">the behavior branches to be selected from</param> public RootSelector(BehaviorTree bt, Func<int> func_index, params BehaviorComponent[] behaviors) : base(bt, behaviors) { mFuncIndex = func_index; //mBehaviors = behaviors; }