Example #1
0
 public ConditionalDecorator(IConditional <T> conditional, bool shouldReevalute)
 {
     Insist.IsTrue(conditional is IConditional <T>, "conditional must implment IConditional");
     _conditional      = conditional;
     _shouldReevaluate = shouldReevalute;
 }
Example #2
0
 public SpriteAnimation getAnimation(TEnum key)
 {
     Insist.isTrue(_animations.ContainsKey(key), "{0} is not present in animations", key);
     return(_animations[key]);
 }
Example #3
0
 public BehaviorTree <T> Build(float updatePeriod = 0.2f)
 {
     Insist.IsNotNull(_currentNode, "Can't create a behaviour tree with zero nodes");
     return(new BehaviorTree <T>(_context, _currentNode, updatePeriod));
 }
Example #4
0
 public BehaviorTreeBuilder <T> Conditional(Func <T, TaskStatus> func)
 {
     Insist.IsFalse(_parentNodeStack.Count == 0, "Can't create an unnested Conditional node. It must be a leaf node.");
     return(SetChildOnParent(new ExecuteActionConditional <T>(func)));
 }
Example #5
0
 /// <summary>
 /// Splice a sub tree into the parent tree.
 /// </summary>
 public BehaviorTreeBuilder <T> SubTree(BehaviorTree <T> subTree)
 {
     Insist.IsFalse(_parentNodeStack.Count == 0, "Can't splice an unnested sub tree, there must be a parent tree.");
     return(SetChildOnParent(new BehaviorTreeReference <T>(subTree)));
 }
Example #6
0
 public BehaviorTreeBuilder <T> EndComposite()
 {
     Insist.IsTrue(_parentNodeStack.Peek() is Composite <T>, "attempting to end a composite but the top node is a decorator");
     _currentNode = _parentNodeStack.Pop();
     return(this);
 }
Example #7
0
 public BehaviorTreeBuilder <T> LogAction(string text)
 {
     Insist.IsFalse(_parentNodeStack.Count == 0, "Can't create an unnested Action node. It must be a leaf node.");
     return(SetChildOnParent(new LogAction <T>(text)));
 }
Example #8
0
 public BehaviorTreeBuilder <T> WaitAction(float waitTime)
 {
     Insist.IsFalse(_parentNodeStack.Count == 0, "Can't create an unnested Action node. It must be a leaf node.");
     return(SetChildOnParent(new WaitAction <T>(waitTime)));
 }
Example #9
0
 public void SetStyle(SelectBoxStyle style)
 {
     Insist.IsNotNull(style, "style cannot be null");
     this.style = style;
     InvalidateHierarchy();
 }
Example #10
0
 public TiledMapMover(TmxLayer collisionLayer)
 {
     Insist.IsNotNull(collisionLayer, nameof(collisionLayer) + " is required");
     CollisionLayer = collisionLayer;
     TiledMap       = collisionLayer.Map;
 }
Example #11
0
        /// <summary>
        /// Creates a new LockToken and associates it with the supplied parent
        /// </summary>
        internal LockToken(Padlock parent)
        {
            Insist.IsNotNull(parent, "parent");

            _parent = parent;
        }
Example #12
0
 public override void OnAddedToEntity()
 {
     _ownerBody = this.GetComponent <FSRigidBody>();
     Insist.IsNotNull(_ownerBody, "Joint added to an Entity with no RigidBody!");
     CreateJoint();
 }
 public TilledFörflytareRef(TmxLayer collisionLayer)
 {
     Insist.IsNotNull(collisionLayer, nameof(collisionLayer) + " is required");
     KollitionsLager = collisionLayer;
     Karta           = collisionLayer.Map;
 }
Example #14
0
 public SplitPane SetMaxSplitAmount(float amount)
 {
     Insist.IsTrue(amount > 0, "maxAmount has to be <= 1");
     _maxAmount = amount;
     return(this);
 }
Example #15
0
 public SplitPane SetMinSplitAmount(float amount)
 {
     Insist.IsTrue(amount < 0, "minAmount has to be >= 0");
     _minAmount = amount;
     return(this);
 }