public void update() { CONFIGURATION_CARD.update(robotName, credits, robot.getDurability(), robot.getRemainingDurability(), robot.getRobotStatStrings(), robot.getWeight() > robot.getMaxForce(), robotParts.ToArray(), colorScheme, enableCreditsSpentAnimation); checkConfigurationCardRepairButtonStates(); checkConfigurationCardRemoveParts(); checkConfigurationCardRobotName(); INVENTORY_CARD.update(credits, humanParts.ToArray(), robotParts.ToArray()); checkInventoryCardMode(); if (BATTLE_BUTTON.GetComponent <ButtonListener>().isClicked()) { BATTLE_BUTTON.GetComponent <ButtonListener>().resetClick(); if (robot.getRemainingDurability() > 0) { goToField = true; } } BATTLE_BUTTON.GetComponent <UnityEngine.UI.Image>().color = robot.getRemainingDurability() <= 0 ? INACTIVE_BATTLE_BUTTON_COLOR : ACTIVE_BATTLE_BUTTON_COLOR; }
public Workshop(List <Mesh> meshes, Robot previewRobot, string robotName, List <Part> humanParts, Part[] robotParts, long credits, Color colorScheme, bool enableCreditsSpentAnimation) { MESHES = meshes; this.previewRobot = previewRobot; this.robotName = robotName; this.humanParts = humanParts; this.credits = credits; this.colorScheme = colorScheme; this.enableCreditsSpentAnimation = enableCreditsSpentAnimation; goToField = false; GameObject widgetsPanel = GameObject.Find("WidgetsPanel"); foreach (Transform child in widgetsPanel.transform) { GameObject.Destroy(child.gameObject); } GameObject partsPanel = GameObject.Find("PartsPanel"); foreach (Transform child in partsPanel.transform) { GameObject.Destroy(child.gameObject); } MASK = GameObject.Find("Workshop").transform.Find("WorkshopMask").gameObject; MASK.SetActive(false); BATTLE_BUTTON = GameObject.Find("BattleButton"); ACTIVE_BATTLE_BUTTON_COLOR = BATTLE_BUTTON.GetComponent <UnityEngine.UI.Image>().color; this.robotParts = new List <Part>(); if (robotParts != null && robotParts.Length > 0) { this.robotParts.AddRange(robotParts); robot = new Robot("", true, true, this.robotParts.ToArray()); CONFIGURATION_CARD = new ConfigurationCard(robotName, credits, robot.getDurability(), robot.getRemainingDurability(), robot.getRobotStatStrings(), robot.getWeight() > robot.getMaxForce(), this.robotParts.ToArray(), colorScheme, enableCreditsSpentAnimation); CONFIGURATION_CARD.enable(); INVENTORY_CARD = new InventoryCard(this.credits, this.humanParts.ToArray(), this.robotParts.ToArray()); INVENTORY_CARD.enable(); } partWithPreviewedTexture = null; }