public void ToNodes(ICodeNode parentNode) { RootNode rootNode = parentNode.GetRootNode(); ArithmeticOperationNode arithOpNode = CreateNode(rootNode); parentNode.AddChildNode(arithOpNode); }
public void ToNodes(ICodeNode parentNode) { RootNode rootNode = parentNode.GetRootNode(); LogicalOperationNode logicOpNode = CreateNode(rootNode); parentNode.AddChildNode(logicOpNode); }
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) { 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); }