public void ToNodes(ICodeNode parentNode) { RootNode rootNode = parentNode.GetRootNode(); ArithmeticOperationNode arithOpNode = CreateNode(rootNode); parentNode.AddChildNode(arithOpNode); }
public void ToNodes(ICodeNode parentNode) { HighlightableButton highlightableButton = (GameObjectHelper.HasComponent <HighlightableButton>(this.gameObject)) ? this.GetComponent <HighlightableButton>() : null; ActionExecutorNode node = new ActionExecutorNode(highlightableButton, actionMap[bloxAction], IsCharacterExecutingAction); parentNode.AddChildNode(node); }
public void ToNodes(ICodeNode parentNode) { RootNode rootNode = parentNode.GetRootNode(); LogicalOperationNode logicOpNode = CreateNode(rootNode); parentNode.AddChildNode(logicOpNode); }
public void ToNodes(ICodeNode parentNode) { HighlightableButton highlightableButton = (GameObjectHelper.HasComponent <HighlightableButton>(this.gameObject)) ? this.GetComponent <HighlightableButton>() : null; StringNode stringNode = new StringNode(highlightableButton, GetValue()); stringNode.NodeName = GetName(); parentNode.AddChildNode(stringNode); }
public void ToNodes(ICodeNode parentNode) { RootNode rootNode = parentNode.GetRootNode(); List <ObjectNode> variables = BloxParams.Where(p => GameObjectHelper.CanBeCastedAs <VariableChoiceBlox>(p)).Select(p => (p as VariableChoiceBlox).ToObjectNode(rootNode)).ToList(); OutputMessageNode outputMsgNode = new OutputMessageNode(this.GetComponent <HighlightableButton>(), this.LogOutputPanel.AddMessage, variables); parentNode.AddChildNode(outputMsgNode); }
public void ToNodes(ICodeNode parentNode) { HighlightableButton highlightableButton = (GameObjectHelper.HasComponent <HighlightableButton>(this.gameObject)) ? this.GetComponent <HighlightableButton>() : null; //Creates an integer node for the counter //This won't correspond to an integer blox. IntegerNode counter = new IntegerNode(null, int.Parse(GetValue())); counter.NodeName = this.GetName(); //Adds it to parent parentNode.AddChildNode(counter); //Creates the for node ForNode forNode = new ForNode(highlightableButton, counter, int.Parse(FromField.text), int.Parse(ToField.text)); parentNode.AddChildNode(forNode); //This node has child nodes. Ensures that child nodes are created from child bloxes CompileChildrenToNodes(forNode); }
public void ToNodes(ICodeNode parentNode) { RootNode rootNode = parentNode.GetRootNode(); HighlightableButton highlightableButton = (GameObjectHelper.HasComponent <HighlightableButton>(this.gameObject)) ? this.GetComponent <HighlightableButton>() : null; //Checks if this blox has a param if it has creates an ArithmeticOperationNode instead of an Integer node if (this.BloxParams.Count > 0) { ArithmeticOperatorBlox arithOpBlox = BloxParams[0].GetComponent <ArithmeticOperatorBlox>(); ArithmeticOperationNode arithOpNode = arithOpBlox.CreateNode(rootNode); arithOpNode.NodeName = this.GetName(); parentNode.AddChildNode(arithOpNode); } else { IntegerNode intNode = new IntegerNode(highlightableButton, GetValueAsInt()); intNode.NodeName = this.GetName(); parentNode.AddChildNode(intNode); } }
public void ToNodes(ICodeNode parentNode) { RootNode rootNode = parentNode.GetRootNode(); HighlightableButton highlightableButton = (GameObjectHelper.HasComponent <HighlightableButton>(this.gameObject)) ? this.GetComponent <HighlightableButton>() : null; //Checks if this blox has a param if it has creates an LogicalOperationNode instead of an BOOLeger node if (this.BloxParams.Count > 0) { LogicalOperatorBlox logicOpBlox = BloxParams[0].GetComponent <LogicalOperatorBlox>(); LogicalOperationNode logicOpNode = logicOpBlox.CreateNode(rootNode); logicOpNode.NodeName = this.GetName(); parentNode.AddChildNode(logicOpNode); } else { BooleanNode boolNode = new BooleanNode(highlightableButton, GetValueAsBoolean()); boolNode.NodeName = this.GetName(); parentNode.AddChildNode(boolNode); } }
public void ToNodes(ICodeNode parentNode) { RootNode rootNode = parentNode.GetRootNode(); IfNode ifNode = null; HighlightableButton highlightableButton = (GameObjectHelper.HasComponent <HighlightableButton>(this.gameObject)) ? this.GetComponent <HighlightableButton>() : null; // IfNode can receive either a bool variable (chosen in dropdown) or a LogicalOperatorBlox as param // If it has received a param (LogicalOperatorBlox), creates a LogicalOperationNode // and instantiates ifNode with it if (BloxParams.Count > 0) { LogicalOperatorBlox blox = BloxParams[0].GetComponent <LogicalOperatorBlox>(); LogicalOperationNode logicOpNode = blox.CreateNode(rootNode); ifNode = new IfNode(highlightableButton, logicOpNode); } // If a variable was chosen, will search for an existing BooleanNode with that same name else { // Gets the selected boolean variable string selectedBoolVarName = GameObjectHelper.GetDropdownSelectedTextValue(this.booleanVariablesDropdown); ICodeNode foundNode = rootNode.SearchChildByName(selectedBoolVarName); if (foundNode != null && GameObjectHelper.CanBeCastedAs <BooleanNode>(foundNode)) { BooleanNode boolNode = (BooleanNode)foundNode; ifNode = new IfNode(highlightableButton, boolNode); } else { throw new System.Exception("Expected " + selectedBoolVarName + " to be a boolean node"); } } parentNode.AddChildNode(ifNode); CompileChildrenToNodes(ifNode); }