private Node MakeDecoratorNode(DecoratorNodeType decorator, uint childNodeID, uint extra = 0) { Node newNode; if (!m_nodeDic.TryGetValue(childNodeID, out Node result)) { return(null); // failed to get childNodeID } switch (decorator) { case DecoratorNodeType.Inverter: newNode = new Inverter(result); break; case DecoratorNodeType.Repeater: newNode = new Repeater(result, extra); break; case DecoratorNodeType.RepeatTillFail: newNode = new RepeatTillFail(result); break; case DecoratorNodeType.Limiter: newNode = new Limiter(result); break; default: return(null); // tried to create unknown decorator node } return(newNode); }
public void FAILURE1() { myTestsFuncs.counter = 0; myTestsFuncs.target = 10; ActionNode IncAction = new ActionNode(myTestsFuncs.CounterInc); RepeatTillFail test = new RepeatTillFail(IncAction); test.Run(); Assert.AreEqual(NodeStates.FAILURE, test.NodeState); }