示例#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
文件: Bt.cs 项目: yinlei/Fishing
 //-------------------------------------------------------------------------
 public Bt(Entity self)
 {
     // 建立行为树
     mSelf = self;
     mBehaviorTree = new BehaviorTree();
     mBehaviorTree.Blackboard.setData("Entity", mSelf);
     Blackboard = mBehaviorTree.Blackboard;
 }
示例#4
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;
 }
示例#5
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;
 }
示例#6
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;
 }
示例#7
0
文件: Action2.cs 项目: yinlei/Fishing
 //---------------------------------------------------------------------
 public Action2(BehaviorTree bt)
     : base(bt)
 {
 }
示例#8
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;
 }
示例#9
0
 //---------------------------------------------------------------------
 public BehaviorComponent(BehaviorTree bt) { mBehaviorTree = 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
 //---------------------------------------------------------------------
 // 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;
 }
示例#12
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;
 }
示例#13
0
文件: BtChild.cs 项目: yinlei/Fishing
 //-------------------------------------------------------------------------
 public BtChild(IComponent co_actorai, Blackboard blackboard, BehaviorTree bt)
 {
     CoActorAi = (CellActorMirrorAi<DefActorMirrorAi>)co_actorai;
     Blackboard = blackboard;
     BehaviorTree = bt;
 }
示例#14
0
文件: Action1.cs 项目: yinlei/Fishing
 //---------------------------------------------------------------------
 public Action1(BehaviorTree bt, Func<BehaviorTree, object[], BehaviorReturnCode> action, params object[] list_param)
     : base(bt)
 {
     mAction = action;
     mListParam = list_param;
 }
示例#15
0
 //---------------------------------------------------------------------
 // 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;
 }
示例#16
0
 //---------------------------------------------------------------------
 // Selects among the given behavior components
 // 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 Selector(BehaviorTree bt, params BehaviorComponent[] behaviors)
     : base(bt)
 {
     _Behaviors = behaviors;
 }
示例#17
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;
 }
示例#18
0
 //-------------------------------------------------------------------------
 public BehaviorReturnCode actionDummy(BehaviorTree bt, params object[] list_param)
 {
     return BehaviorReturnCode.Success;
 }
示例#19
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;
 }
示例#20
0
 //-------------------------------------------------------------------------
 public bool conditionPlayerManual(BehaviorTree bt, params object[] list_param)
 {
     return true;
 }
示例#21
0
 //---------------------------------------------------------------------
 // Selects among the given behavior components
 // 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 Selector(BehaviorTree bt, params BehaviorComponent[] behaviors)
     : base(bt)
 {
     _Behaviors = behaviors;
 }
示例#22
0
 //-------------------------------------------------------------------------
 //-------------------------------------------------------------------------
 public BtChildPlayerManual(IComponent co_actorai, Blackboard blackboard, BehaviorTree bt)
     : base(co_actorai, blackboard, bt)
 {
 }