public override GameObject constructCommandUIComponent(string commandUIName, Statement statement) { //In this method we have created a flag to identify which type of statement will be handled by generateStatementFromUI() GameObject commandObject; GameObject dropdownObject; GameObject statementButtonAdditons; MoveStatement1 moveStatement; //Brute Move BruteMove bruteStatement; GameObject coordinateDisplay; commandObject = new GameObject(); commandObject.name = commandUIName; //Statement type in constructCommandUIComponent() is decided here and is rendered in Touch Input if (statement.GetType().IsSubclassOf(typeof(MoveStatement1))) { moveStatement = (MoveStatement1)statement; dropdownObject = movementTypeSelector.generateMovmentTypeSelectorFromStatement(moveStatement); dropdownObject.transform.SetParent(commandObject.transform, false); //denote the statementType flag value moveType = true; countmoveType++; coordinateDisplay = coordinateSelector.createCoordinatesSelector(moveStatement); coordinateDisplay.transform.SetParent(commandObject.transform, false); } //constructing command UI component for Brute Move else if (statement.GetType().IsSubclassOf(typeof(BruteMove))) { //BruteMove Prefab GameObject brutePrefabObject = Instantiate(brutePrefab); brutePrefabObject.transform.SetParent(commandObject.transform, false); bruteStatement = (BruteMove)statement; dropdownObject = movementTypeSelector.generateBruteMovmentTypeSelectorFromStatement(bruteStatement); dropdownObject.transform.SetParent(commandObject.transform, false); //denote the statementType flag value bruteType = true; countbruteType++; coordinateDisplay = coordinateSelector.createBruteCoordinatesSelector(bruteStatement); //BruteMove coordinates coordinateDisplay.transform.SetParent(commandObject.transform, false); } else { if (statement is ClawUp) { GameObject clawPrefabObject = Instantiate(clawPrefab); ClawUp statementToggle = (ClawUp)statement; ToggleClaw toggleClawScript = clawPrefabObject.GetComponentInChildren <ToggleClaw>(); if (toggleClawScript != null) { if (toggleClawScript.clawUp == statementToggle.isClawUp) { } else { toggleClawScript.toggleClaw(); } } clawPrefabObject.transform.SetParent(commandObject.transform, false); } /* * if(statement is ToggleSuction1) * { /* * GameObject toggleSuctionObject = Instantiate(suctionTogglePrefab); * ToggleSuction1 statementToggle = (ToggleSuction1)statement; * ToggleSuctionCup toggleSuctionCupScript = toggleSuctionObject.GetComponentInChildren<ToggleSuctionCup>(); * if(toggleSuctionCupScript != null) * { * if(toggleSuctionCupScript.suctionOn == statementToggle.isSuctionEnabled) * { * * } * else * { * toggleSuctionCupScript.toggleSuction(); * } * } * toggleSuctionObject.transform.SetParent(commandObject.transform, false); * } */ } statementButtonAdditons = Instantiate(statementButtonAdditonsPrefab); statementButtonAdditons.transform.SetParent(commandObject.transform, false); //statementButtonAdditons.SetActive(false); return(commandObject); }