Beispiel #1
0
 public Repeat(uint times, BehaviorComponent behavior) : base(behavior)
 {
     this.times = times;
 }
Beispiel #2
0
        /// <summary>
        /// executes the behavior after a given amount of time in miliseconds has passed
        /// </summary>
        /// <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 Timer(TimerDelegate elapsedTimeFunction, long timeToWait, BehaviorComponent behavior)
         * {
         * _ElapsedTimeFunction = elapsedTimeFunction;
         * _Behavior = behavior;
         * _WaitTime = timeToWait;
         * }*/

        public Timer(float timeToWait, BehaviorComponent behavior) : base(behavior)
        {
            _WaitTime = timeToWait;
            stopwatch = new Stopwatch();
        }
Beispiel #3
0
 /// <summary>
 /// Returns Suceess no matter what
 /// </summary>
 /// <param name="behavior"></param>
 public Succeeder(BehaviorComponent behavior) : base(behavior)
 {
 }
Beispiel #4
0
 /// <summary>
 /// inverts the given behavior
 /// -Returns Success on Failure or Error
 /// -Returns Failure on Success
 /// -Returns Running on Running
 /// </summary>
 /// <param name="behavior"></param>
 public Inverter(BehaviorComponent behavior) : base(behavior)
 {
 }
Beispiel #5
0
 /// <summary>
 /// randomly executes the behavior
 /// </summary>
 /// <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 RandomDecorator(float probability, Func <float> randomFunction, BehaviorComponent behavior) : base(behavior)
 {
     _Probability    = probability;
     _RandomFunction = randomFunction;
 }
Beispiel #6
0
 public RunForSeconds(float timeToRun, BehaviorComponent behavior) : base(behavior)
 {
     _WaitTime = timeToRun;
     stopwatch = new Stopwatch();
 }
Beispiel #7
0
 public UntilFail(BehaviorComponent behavior) : base(behavior)
 {
 }
Beispiel #8
0
 /// <summary>
 /// 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
 /// </summary>
 /// <param name="maxCount">max number to count to</param>
 /// <param name="behavior">behavior to run</param>
 public Counter(int maxCount, BehaviorComponent behavior) : base(behavior)
 {
     _MaxCount = maxCount;
 }
Beispiel #9
0
 public Decorator(BehaviorComponent behavior)
 {
     this._Behavior = behavior;
 }