示例#1
0
 //---------------------------------------------------------------------
 // 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;
 }
示例#2
0
 //---------------------------------------------------------------------
 // randomly executes the behavior
 // <param name="probability">probability of execution</param>
 // <param name="randomFunction">function that determines probability to execute</param>
 // <param name="behavior">behavior to execute</param>
 public DecoratorRandom(BehaviorTree bt, float probability, Func<float> func_random, BehaviorComponent behavior)
     : base(bt)
 {
     mProbability = probability;
     mRandomFunction = func_random;
     mBehavior = behavior;
 }
示例#3
0
 //---------------------------------------------------------------------
 // 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;
 }
示例#4
0
 //---------------------------------------------------------------------
 // Selects among the given behavior components (one evaluation per Behave call)
 // 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 Failure or Running
 // -Returns Failure if all behavior components returned Failure or an error has occured
 public PartialSelector(BehaviorTree bt, params BehaviorComponent[] behaviors)
     : base(bt)
 {
     mBehaviors = behaviors;
     _selLength = (short)mBehaviors.Length;
 }
示例#5
0
 //---------------------------------------------------------------------
 // attempts to run the behaviors all in one cycle (stateful on running)
 // -Returns Success when all are successful
 // -Returns Failure if one behavior fails or an error occurs
 // -Does not Return Running
 public StatefulSequence(BehaviorTree bt, params BehaviorComponent[] behaviors)
     : base(bt)
 {
     this._Behaviors = behaviors;
 }
示例#6
0
 //---------------------------------------------------------------------
 public BehaviorComponent(BehaviorTree bt) { mBehaviorTree = bt; }
示例#7
0
 //---------------------------------------------------------------------
 // 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;
 }
示例#8
0
 //---------------------------------------------------------------------
 // Randomly selects and performs one of the passed behaviors
 // -Returns Success if selected behavior returns Success
 // -Returns Failure if selected behavior returns Failure
 // -Returns Running if selected behavior returns Running
 public RandomSelector(BehaviorTree bt, params BehaviorComponent[] behaviors)
     : base(bt)
 {
     _Behaviors = behaviors;
 }
示例#9
0
文件: Action2.cs 项目: yinlei/GF.Core
 //---------------------------------------------------------------------
 public Action2(BehaviorTree bt)
     : base(bt)
 {
 }
示例#10
0
 //---------------------------------------------------------------------
 // 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;
 }
示例#11
0
文件: Action1.cs 项目: yinlei/GF.Core
 //---------------------------------------------------------------------
 public Action1(BehaviorTree bt, Func<BehaviorTree, object[], BehaviorReturnCode> action, params object[] list_param)
     : base(bt)
 {
     mAction = action;
     mListParam = list_param;
 }
示例#12
0
 //---------------------------------------------------------------------
 // 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;
 }
示例#13
0
 //---------------------------------------------------------------------
 public BehaviorComponent(BehaviorTree bt)
 {
     mBehaviorTree = bt;
 }
示例#14
0
 //---------------------------------------------------------------------
 // Performs the given behavior components sequentially (one evaluation per Behave call)
 // Performs an AND-Like behavior and will perform each successive component
 // -Returns Success if all behavior components return Success
 // -Returns Running if an individual behavior component returns Success or Running
 // -Returns Failure if a behavior components returns Failure or an error is encountered
 public PartialSequence(BehaviorTree bt, params BehaviorComponent[] behaviors)
     : base(bt)
 {
     _Behaviors = behaviors;
     _seqLength = (short) _Behaviors.Length;
 }
示例#15
0
 //---------------------------------------------------------------------
 // attempts to run the behaviors all in one cycle
 // -Returns Success when all are successful
 // -Returns Failure if one behavior fails or an error occurs
 // -Returns Running if any are running
 public Sequence(BehaviorTree bt, params BehaviorComponent[] behaviors)
     : base(bt)
 {
     _behaviors = behaviors;
 }