public Store(List <Mesh> meshes, Robot previewRobot, Part[] storeParts, List <Part> humanParts, Part[] robotParts, long credits, ConfigurationCard configurationCard, Color colorScheme, bool enableCreditsSpentAnimation) { MESHES = meshes; this.previewRobot = previewRobot; this.humanParts = humanParts; this.credits = credits; this.colorScheme = colorScheme; this.enableCreditsSpentAnimation = enableCreditsSpentAnimation; GameObject storePanel = GameObject.Find("StorePanel"); foreach (Transform child in storePanel.transform) { GameObject.Destroy(child.gameObject); } MASK = GameObject.Find("Store").transform.Find("StoreMask").gameObject; MASK.SetActive(false); this.robotParts = new List <Part>(); if (robotParts != null && robotParts.Length > 0) { this.robotParts.AddRange(robotParts); robot = new Robot("", true, true, this.robotParts.ToArray()); STORE_PARTS = new List <Part>(); STORE_PARTS.AddRange(storeParts); STORE_CARD = new StoreCard(this.credits, STORE_PARTS.ToArray(), this.humanParts.ToArray(), this.robotParts.ToArray(), colorScheme, enableCreditsSpentAnimation); STORE_CARD.enable(); CONFIGURATION_CARD = configurationCard; } mode = StoreCard.MODES.VIEW_PART_STATS; PERFORMANCE_METRIC_CALCULATOR = new PerformanceMetricCalculator(); partBought = null; partWithPreviewedTexture = null; }
public AIManager(int numberOfAgents, int numberOfEnemies, Robot[] humanRobots, Part[] parts, Part[] baseParts, Obstacle[] obstacles, Dimension fieldSize, List <BuildHubState> buildHubStates, List <FieldState> fieldStates, long experience) { NUMBER_OF_AGENTS = numberOfAgents; NUMBER_OF_ENEMIES = numberOfEnemies; HUMAN_ROBOTS = humanRobots; PARTS = parts; BASE_PARTS = baseParts; OBSTACLES = obstacles; NUMBER_OF_OBSTACLES = OBSTACLES.Length; FIELD_SIZE = fieldSize; CREDITS = experience; PERFORMANCE_METRIC_CALCULATOR = new PerformanceMetricCalculator(); AI_AGENTS = new AIAgent[NUMBER_OF_AGENTS]; PRIOR_BUILD_HUB_STATES = new BuildHubState[NUMBER_OF_AGENTS]; PRIOR_FIELD_STATES = new FieldState[NUMBER_OF_AGENTS]; BUILD_HUB_ACTIONS_TO_PERFORM = new BuildHubAction[NUMBER_OF_AGENTS]; FIELD_ACTIONS_TO_PERFORM = new FieldAction[NUMBER_OF_AGENTS]; ROBOT_CAMERAS = new Camera[NUMBER_OF_AGENTS]; PRIOR_DISTANCE_FROM_ENEMY = new double[NUMBER_OF_ENEMIES]; PRIOR_DURABILITY_REMAINING = new double[NUMBER_OF_AGENTS]; PRIOR_DAMAGE_DEALT = new double[NUMBER_OF_AGENTS]; STUCK_IN_STATE_FOR_TURN_COUNT = new int[NUMBER_OF_AGENTS]; AGENT_POSITIONS = new Point[NUMBER_OF_AGENTS]; AGENT_ENEMY_POSITIONS = new Point[NUMBER_OF_AGENTS][]; for (int agentIndex = 0; agentIndex < NUMBER_OF_AGENTS; ++agentIndex) { AGENT_ENEMY_POSITIONS[agentIndex] = new Point[NUMBER_OF_ENEMIES]; } RANDOM = new System.Random(); EFFECT_ON_OBSTACLE = false; STEEPEST_OBSTACLE_ANGLE = 0; HIGHEST_FRICTION = 0; foreach (Obstacle obstacle in OBSTACLES) { if (obstacle.getEffect() != default) { EFFECT_ON_OBSTACLE = true; } if (obstacle.getSlopeAngle() > STEEPEST_OBSTACLE_ANGLE) { STEEPEST_OBSTACLE_ANGLE = obstacle.getSlopeAngle(); } if (obstacle.getFriction() > HIGHEST_FRICTION) { HIGHEST_FRICTION = obstacle.getFriction(); } } BUILD_HUB_STATES = buildHubStates; if (BUILD_HUB_STATES == default) { BUILD_HUB_STATES = new List <BuildHubState>(); } startAgents(fieldStates); actionsUpdated = false; actionThread = new Thread(updateActions); actionThread.Start(); }
public ConfigurationCard(string robotName, long credits, double durability, double remainingDurability, string[] robotStatStrings, bool maxForceExceeded, Part[] parts, Color colorScheme, bool enableCreditsSpentAnimation) { this.robotName = robotName; this.credits = credits; this.durability = durability; this.remainingDurability = remainingDurability; this.robotStatStrings = robotStatStrings; this.maxForceExceeded = maxForceExceeded; this.parts = new List <Part>(); attachments = new List <Attachment>(); this.colorScheme = colorScheme; this.enableCreditsSpentAnimation = enableCreditsSpentAnimation; foreach (Part part in parts) { if (!(part is Attachment)) { this.parts.Add(part); } else { this.attachments.Add((Attachment)part); } } mode = InventoryCard.MODES.VIEW_PART_STATS; MASKED_ROBOT_WIDGET = GameObject.Find("Workshop").transform.Find("MaskedRobotWidget").gameObject; MASKED_ROBOT_WIDGET.SetActive(false); partBeingPreviewed = null; partToEquipt = null; PERFORMANCE_METRIC_CALCULATOR = new PerformanceMetricCalculator(); SCROLL_VIEW = GameObject.Find(CONFIGURATION_CARD_NAME); GameObject partsContainerGameObject = GameObject.Find(WIDGETS_CONTAINER_NAME); WIDGETS_CONTAINER = partsContainerGameObject.GetComponent <RectTransform>(); SCROLL_RECT = SCROLL_VIEW.GetComponent <ScrollRect>(); WIDGETS_PANEL = GameObject.Find(WIDGETS_PANEL_NAME).GetComponent <RectTransform>(); SCROLLBAR_OBJECT = GameObject.Find(WIDGETS_CARD_NAME).transform.Find(CONFIGURATION_SCROLLBAR_NAME).gameObject; SCROLLBAR = SCROLLBAR_OBJECT.GetComponent <Scrollbar>(); SCROLLBAR_OBJECT.SetActive(false); SCROLL_RECT.vertical = false; robotWidget = GameObject.Find(CONFIGURATION_CARD_NAME).transform.Find(ROBOT_WIDGET_NAME).gameObject; robotWidgetLabel = robotWidget.transform.Find(ROBOT_WIDGET_LABEL_NAME).gameObject; robotWidgetLabelPlaceholder = robotWidgetLabel.transform.Find("Text Area").Find(ROBOT_WIDGET_LABEL_PLACEHOLDER_NAME).gameObject; robotWidgetLabelPlaceholder.GetComponent <TextMeshProUGUI>().enabled = false; robotWidgetLabelText = robotWidgetLabel.transform.Find("Text Area").Find(ROBOT_WIDGET_LABEL_TEXT_NAME).gameObject; robotWidgetDurabilityBar = robotWidget.transform.Find(ROBOT_WIDGET_DURABILITY_BAR_NAME).gameObject; robotWidgetDurabilityBarLabel = robotWidget.transform.Find(ROBOT_WIDGET_DURABILITY_BAR_LABEL_NAME).gameObject; robotWidgetStats = robotWidget.transform.Find(ROBOT_WIDGET_STATS_NAME).gameObject; WORKSHOP_CREDIT = GameObject.Find("WorkshopCredit"); updateCredits(); WORKSHOP_CREDITS_SPENT = GameObject.Find("Workshop").transform.Find("WorkshopCreditsSpent").gameObject; WORKSHOP_CREDITS_SPENT_HOME_POSITION = WORKSHOP_CREDITS_SPENT.transform.localPosition; WORKSHOP_CREDITS_SPENT.SetActive(false); WORKSHOP_CREDIT.GetComponent <TextMeshProUGUI>().color = colorScheme; initialize(); }
public InventoryCard(long credits, Part[] humanParts, Part[] robotParts) { this.credits = credits; this.humanParts = humanParts; this.robotParts = robotParts; mode = MODES.VIEW_PART_STATS; partBeingPreviewed = null; partBeingEquipt = null; currentPartFilter = DEFAULT_PART_FILTER; MASKED_INVENTORY_PART_BUTTON = GameObject.Find("Workshop").transform.Find("MaskedInventoryPartButton").gameObject; MASKED_INVENTORY_PART_BUTTON.SetActive(false); INVENTORY_SORT = GameObject.Find("InventorySort"); currentSort = DEFAULT_SORT; PERFORMANCE_METRIC_CALCULATOR = new PerformanceMetricCalculator(); SCROLL_VIEW = GameObject.Find(INVENTORY_CARD_NAME); GameObject partsContainerGameObject = GameObject.Find(PARTS_CONTAINER_NAME); PARTS_CONTAINER = partsContainerGameObject.GetComponent <RectTransform>(); SCROLL_RECT = SCROLL_VIEW.GetComponent <ScrollRect>(); PARTS_PANEL = GameObject.Find(PARTS_PANEL_NAME).GetComponent <RectTransform>(); SCROLLBAR_OBJECT = GameObject.Find(INVENTORY_CARD_NAME).transform.Find(INVENTORY_SCROLLBAR_NAME).gameObject; SCROLLBAR = SCROLLBAR_OBJECT.GetComponent <Scrollbar>(); SCROLLBAR_OBJECT.SetActive(false); SCROLL_RECT.vertical = false; partButtons = new List <GameObject>(); partInfo = GameObject.Find("Workshop").transform.Find(PART_INFO_NAME).gameObject; partType = partInfo.transform.Find(PART_TYPE_NAME).gameObject; durabilityBar = partInfo.transform.Find(DURABILITY_BAR_NAME).gameObject; durabilityBarLabel = partInfo.transform.Find(DURABILITY_BAR_LABEL_NAME).gameObject; partStats = partInfo.transform.Find(PART_STATS_NAME).gameObject; partInfo.SetActive(false); partStatsList = new List <GameObject>(); initialize(); PART_TABS = new List <GameObject>(); foreach (Transform childTransform in GameObject.Find("InventoryTabs").transform.Find("InventoryTabMask")) { if (childTransform.gameObject.name.Contains(PART_TAB_SUFFIX)) { PART_TABS.Add(childTransform.gameObject); } } updateSorting(); }
private async void initializeScene(string sceneName) //test stuff inside! will need to be rewritten for actual game { running = true; saveDataThread = new Thread(saveData); saveDataThread.Start(); if (currentSettings == "") { currentSettings = SettingsManager.DEFAULT_SETTINGS; } SettingPairs settingPairs = settingsManager.getSettingPairs(currentSettings); settingList = settingsManager.getSettingList(currentSettings); fieldSize = Field.getFieldSize(settingPairs.field_size); foreach (PartData partData in partsData) { Part part = partManager.partDataToPart(partData); if (part.GAME_OBJECT != null) { part.toggleGameObject(false); } parts.Add(part); } if (currentTest == TESTS.BUILD_HUB) { IconGenerator iconGenerator = new IconGenerator(); Camera camera = null; foreach (Camera currCam in Camera.allCameras) { if (currCam.name == "IconCamera") { camera = currCam; camera.forceIntoRenderTexture = true; break; } } iconGenerator.camera = camera; Camera.main.targetDisplay = 1; foreach (Part part in parts) { if (part.GAME_OBJECT == null) { continue; } part.toggleGameObject(true); part.GAME_OBJECT.transform.Rotate(new Vector3(9, 120, -15)); iconGenerator.gameObjectOfIcon = part.GAME_OBJECT; while (part.getIcon() == null) { if (part.GAME_OBJECT.GetComponent <Renderer>().isVisible) { iconGenerator.initialize(); if (iconGenerator.getIcon() != null) { part.setIcon(iconGenerator.getIcon()); } } if (part.getIcon() == null) { await Task.Delay(25); } } part.toggleGameObject(false); part.destroyGameObject(); } Camera.main.targetDisplay = 0; } else { foreach (Part part in parts) { if (part.GAME_OBJECT != null) { part.destroyGameObject(); } } } experience = playerData.experience; credits = playerData.credits; previousRoundDamageDifference = playerData.previousRoundDamageDifference; previousRoundMaxDamageDifference = playerData.previousRoundMaxDamageDifference; previousRoundTimeElapsed = playerData.previousRoundTimeElapsed; ObstacleGenerator obstacleGenerator = new ObstacleGenerator(experience, settingPairs.max_obstacles, fieldSize); humanRobotParts = new List <Part>(); obstaclesData = new List <ObstacleData>(); List <int> badIndices = new List <int>(); PerformanceMetricCalculator performanceMetricCalculator = new PerformanceMetricCalculator(); Head cheapestHead = null; Body cheapestBody = null; Mobility cheapestMobility = null; Blaster cheapestBlaster = null; foreach (Part part in parts) { if (part is Head && (cheapestHead == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestHead))) { cheapestHead = (Head)part; } else if (part is Body && (cheapestBody == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestBody))) { cheapestBody = (Body)part; } else if (part is Mobility && (cheapestMobility == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestMobility))) { cheapestMobility = (Mobility)part; } else if (part is Blaster && (cheapestBlaster == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestBlaster))) { cheapestBlaster = (Blaster)part; } } if (playerData.humanRobotParts != default) { for (int partIndex = 0; partIndex < playerData.humanRobotParts.Length; ++partIndex) { PlayerPartData playerPartData = playerData.humanRobotParts[partIndex]; if (parts.Exists(p => p.getID() == playerPartData.id)) { Part part = parts.Find(p => p.getID() == playerPartData.id); part.damage(part.getDurability() - playerPartData.remainingDurability); if (part is Head) { humanRobotParts.Add((Head)part.clone(true)); } else if (part is Body) { humanRobotParts.Add((Body)part.clone(true)); } else if (part is Mobility) { humanRobotParts.Add((Mobility)part.clone(true)); } else if (part is Attachment) { humanRobotParts.Add((Attachment)part.clone(true)); } } else { humanRobotParts.Add(null); badIndices.Add(partIndex); } } } else { humanRobotParts.AddRange(new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }); } myRobots = new List <Robot>(); if (playerData.myRobots != default) { foreach (RobotData robotData in playerData.myRobots) { List <Part> robotPartList = new List <Part>(); foreach (int partIndex in robotData.partIndices) { if (!badIndices.Contains(partIndex)) { robotPartList.Add(humanRobotParts[partIndex]); } } try { Robot robot = new Robot(robotData.name, true, robotData.human, robotPartList.ToArray()); myRobots.Add(robot); } catch {} } } foreach (int index in badIndices) { humanRobotParts.RemoveAt(index); } if (!humanRobotParts.Exists(part => part is Head)) { humanRobotParts.Add(cheapestHead); } if (!humanRobotParts.Exists(part => part is Body)) { humanRobotParts.Add(cheapestBody); } if (!humanRobotParts.Exists(part => part is Mobility)) { humanRobotParts.Add(cheapestMobility); } if (!humanRobotParts.Exists(part => part is Attachment && ((Attachment)part).isWeapon())) { humanRobotParts.Add(cheapestBlaster); } if (humanRobotParts.Contains(null)) { throw new Exception("There are missing part files. There neeeds to be at least one part file each of types Head, Body, Mobility, and a weapon Attachment."); } if (playerData.obstacles != default) { obstaclesData.AddRange(playerData.obstacles); } else { obstaclesData.AddRange(obstacleGenerator.getObstaclesData()); } if (currentSettingValueList.Count == 0) { foreach (Setting setting in settingList) { currentSettingValueList.Add(setting.currentValue); } } Head head1 = null; Head head2 = null; Body body1 = null; Body body2 = null; Mobility mobility = null; Attachment attachment1 = null; Attachment attachment2 = null; Attachment attachment3 = null; foreach (Part part in parts) { if (part is Head) { if (head1 == null) { head1 = (Head)part.clone(true); head1.damage(2); } else if (head2 == null) { head2 = (Head)part.clone(true); head2.damage(3); } } else if (part is Body) { if (body1 == null) { body1 = (Body)part.clone(true); body1.damage(3); } else if (body2 == null) { body2 = (Body)part.clone(true); body2.damage(4); } } else if (part is Mobility) { if (mobility == null) { mobility = (Mobility)part.clone(true); mobility.damage(1); } } else if (part is Attachment) { if (attachment1 == null) { attachment1 = (Attachment)part.clone(true); attachment1.damage(1); } else if (attachment2 == null) { attachment2 = (Attachment)part.clone(true); attachment2.damage(1); } else if (attachment3 == null) { attachment3 = (Attachment)part.clone(true); attachment3.damage(3); } } } List <Robot> robots = new List <Robot>(); int numberOfNonHumanRobots = 0; int numberOfHumanRobots = 0; Obstacle[] obstacles = null; List <BuildHubState> buildHubStates = default; if (buildHubStatesData != default && buildHubStatesData.Count > 0) { buildHubStates = new List <BuildHubState>(); foreach (BuildHubStateData buildHubStateData in buildHubStatesData) { buildHubStates.Add(buildHubStateDataManager.stateDataToState(buildHubStateData)); } } List <FieldState> fieldStates = default; if (fieldStatesData != default && fieldStatesData.Count > 0) { fieldStates = new List <FieldState>(); foreach (FieldStateData fieldStateData in fieldStatesData) { fieldStates.Add(fieldStateDataManager.stateDataToState(fieldStateData, parts)); } } BuildHub.MODES mode; switch (currentTest) { case TESTS.FIELD: case TESTS.HUMAN_V_VOID_ROBOT: List <Part> humanParts = new List <Part>(); foreach (Part part in humanRobot.getParts()) { Part clonePart = part.clone(false); if (clonePart is Head) { clonePart = (Head)clonePart; } else if (clonePart is Body) { clonePart = (Body)clonePart; } else if (clonePart is Mobility) { clonePart = (Mobility)clonePart; } else if (clonePart is Attachment) { clonePart = (Attachment)clonePart; } humanParts.Add(clonePart); } humanRobot = new Robot(humanRobot.getName(), humanRobot.isHuman(), humanParts.ToArray()); currentHumanRobotHealth = humanRobot.getRemainingDurability(); Attachment[] nonHumanAttachments = { (Attachment)attachment1.clone(true) }; numberOfNonHumanRobots = RANDOM.Next(1, settingPairs.max_ai_robots + 1); numberOfHumanRobots = 1; obstacles = obstacleGenerator.obstaclesDataToObstacles(obstaclesData.ToArray()); aiManager = new AIManager(numberOfNonHumanRobots, numberOfNonHumanRobots - 1 + numberOfHumanRobots, new Robot[] { humanRobot }, parts.ToArray(), new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }, obstacles, fieldSize, buildHubStates, fieldStates, experience); robots.Add(humanRobot); robots.AddRange(aiManager.getAgentRobots()); setScreen(new Field(settingList, robots.ToArray(), obstacles, previousRoundDamageDifference, previousRoundMaxDamageDifference, previousRoundTimeElapsed)); break; case TESTS.AI_AGENT_TRAINING: numberOfNonHumanRobots = NUMBER_OF_AGENTS; numberOfHumanRobots = 0; obstacles = obstacleGenerator.obstaclesDataToObstacles(obstaclesData.ToArray()); aiManager = new AIManager(numberOfNonHumanRobots, numberOfNonHumanRobots - 1 + numberOfHumanRobots, null, parts.ToArray(), new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }, obstacles, fieldSize, buildHubStates, fieldStates, experience); Robot[] agentRobots = aiManager.getAgentRobots(); for (int agentIndex = 0; agentIndex < NUMBER_OF_AGENTS; ++agentIndex) { FIELD_AGENT_ROBOTS[agentIndex] = agentRobots[agentIndex]; } robots.AddRange(FIELD_AGENT_ROBOTS); setScreen(new Field(settingList, robots.ToArray(), obstacles, previousRoundDamageDifference, previousRoundMaxDamageDifference, previousRoundTimeElapsed)); break; case TESTS.BUILD_HUB: mode = BuildHub.MODES.MY_ROBOTS; setScreen(new BuildHub(settingList, obstaclesData, myRobots, humanRobotParts, parts.ToArray(), credits, mode)); break; } }
public StoreCard(long credits, Part[] storeParts, Part[] humanParts, Part[] robotParts, Color colorScheme, bool enableCreditsSpentAnimation) { this.credits = credits; this.storeParts = storeParts; this.humanParts = humanParts; this.robotParts = robotParts; this.colorScheme = colorScheme; this.enableCreditsSpentAnimation = enableCreditsSpentAnimation; mode = MODES.VIEW_PART_STATS; partBeingPreviewed = null; partBeingBought = null; currentPartFilter = DEFAULT_STORE_FILTER; STORE_SORT = GameObject.Find("StoreSort"); currentSort = DEFAULT_SORT; PERFORMANCE_METRIC_CALCULATOR = new PerformanceMetricCalculator(); SCROLL_VIEW = GameObject.Find(STORE_CARD_NAME); GameObject storeContainerGameObject = GameObject.Find(STORE_CONTAINER_NAME); STORE_CONTAINER = storeContainerGameObject.GetComponent <RectTransform>(); SCROLL_RECT = SCROLL_VIEW.GetComponent <ScrollRect>(); STORE_PANEL = GameObject.Find(STORE_PANEL_NAME).GetComponent <RectTransform>(); SCROLLBAR = GameObject.Find(STORE_CARD_NAME).transform.Find(STORE_SCROLLBAR_NAME).gameObject; SCROLLBAR.SetActive(false); SCROLL_RECT.vertical = false; storeButtons = new List <GameObject>(); partInfo = GameObject.Find("Store").transform.Find(PART_INFO_NAME).gameObject; partType = partInfo.transform.Find(PART_TYPE_NAME).gameObject; partStats = partInfo.transform.Find(PART_STATS_NAME).gameObject; partInfo.SetActive(false); BUY_PART_BUTTON = GameObject.Find("Store").transform.Find("BuyPart").gameObject; BUY_PART_BUTTON.SetActive(false); STORE_CREDIT = GameObject.Find("StoreCredit"); STORE_CREDIT.GetComponent <TextMeshProUGUI>().color = colorScheme; updateCredits(); STORE_CREDITS_SPENT = GameObject.Find("Store").transform.Find("StoreCreditsSpent").gameObject; STORE_CREDITS_SPENT_HOME_POSITION = STORE_CREDITS_SPENT.transform.localPosition; STORE_CREDITS_SPENT.SetActive(false); partStatsList = new List <GameObject>(); ATTACHMENT_PARTS_ROWS_LABELS = new List <string>(); foreach (Part part in this.storeParts) { if (part is Attachment && !ATTACHMENT_PARTS_ROWS_LABELS.Contains(part.GetType().ToString())) { ATTACHMENT_PARTS_ROWS_LABELS.Add(part.GetType().ToString()); } GameObject storeButton = GameObject.Instantiate(Resources.Load("Prefabs/FeaturedPartButton") as GameObject); Texture2D partIcon = part.getIcon(); if (partIcon != null) { storeButton.transform.Find("Icon").GetComponent <UnityEngine.UI.Image>().sprite = Sprite.Create(partIcon, new Rect(0, 0, partIcon.width, partIcon.height), new Vector2(0.5f, 0.5f), 100); } storeButton.GetComponent <RectTransform>().localScale = Vector3.one; storeButton.transform.localPosition = new Vector3(storeButton.transform.localPosition.x, storeButton.transform.localPosition.y, 0); storeButton.transform.Find("CostLabel").GetComponent <TextMeshProUGUI>().text += PERFORMANCE_METRIC_CALCULATOR.calculateCost(part); storeButton.transform.Find("CostLabel").GetComponent <TextMeshProUGUI>().color = (PERFORMANCE_METRIC_CALCULATOR.calculateCost(part) <= this.credits ? AFFORDABLE_TEXT_COLOR : UNAFFORDABLE_TEXT_COLOR); storeButton.SetActive(false); storeButtons.Add(storeButton); } STORE_TABS = new List <GameObject>(); foreach (Transform childTransform in GameObject.Find("StoreTabs").transform.Find("StoreTabMask")) { if (childTransform.gameObject.name.Contains(STORE_TAB_SUFFIX)) { STORE_TABS.Add(childTransform.gameObject); } } FEATURED_PARTS_ROWS = new List <GameObject>(); foreach (string featuredPartsRowLabel in FEATURED_PARTS_ROWS_LABELS) { GameObject featuredPartsRow = GameObject.Instantiate(Resources.Load("Prefabs/FeaturedPartsRow") as GameObject); string featuredPartsRowLabelText = featuredPartsRow.transform.Find("AllParts").Find("Label").gameObject.GetComponent <TextMeshProUGUI>().text; featuredPartsRow.transform.Find("AllParts").Find("Label").gameObject.GetComponent <TextMeshProUGUI>().text = featuredPartsRowLabelText.Substring(0, featuredPartsRowLabelText.IndexOf(" ") + 1) + featuredPartsRowLabel + featuredPartsRowLabelText.Substring(featuredPartsRowLabelText.IndexOf(" ")); featuredPartsRow.transform.localPosition = new Vector3(featuredPartsRow.transform.localPosition.x, featuredPartsRow.transform.localPosition.y, 0); featuredPartsRow.SetActive(false); FEATURED_PARTS_ROWS.Add(featuredPartsRow); } ATTACHMENT_PARTS_ROWS = new List <GameObject>(); foreach (string attachmentPartsRowLabel in ATTACHMENT_PARTS_ROWS_LABELS) { GameObject attachmentPartsRow = GameObject.Instantiate(Resources.Load("Prefabs/AttachmentPartsRow") as GameObject); string attachmentPartsRowLabelText = attachmentPartsRow.transform.Find("Label").gameObject.GetComponent <TextMeshProUGUI>().text; attachmentPartsRow.transform.Find("Label").gameObject.GetComponent <TextMeshProUGUI>().text = attachmentPartsRowLabel; attachmentPartsRow.transform.localPosition = new Vector3(attachmentPartsRow.transform.localPosition.x, attachmentPartsRow.transform.localPosition.y, 0); attachmentPartsRow.SetActive(false); ATTACHMENT_PARTS_ROWS.Add(attachmentPartsRow); } filterFeaturedParts(); updateSorting(); }