private void ExportIo(float multiplier) { var goods = new List <(Goods, int)>(); foreach (var link in model.links) { var rounded = MathUtils.Round(link.amount * multiplier); if (rounded == 0) { continue; } goods.Add((link.goods, rounded)); } foreach (var flow in model.flow) { var rounded = MathUtils.Round(flow.amount * multiplier); if (rounded == 0) { continue; } goods.Add((flow.goods, rounded)); } BlueprintUtilities.ExportConstantCombinators(projectPage.name, goods); }
// Create thumbnail of given blueprint private Sprite CreateThumbnail(BlueprintModel blueprint) { // Instantiate ship var parent = Ship.InstantiateShip(blueprint, transform); // Get size of ship var bounds = BlueprintUtilities.GetBounds(blueprint); var highestval = bounds.extents.x > bounds.extents.y ? bounds.extents.x : bounds.extents.y; var thumbnailCameraTransform = thumbnailCamera.gameObject.transform; var originalPosition = thumbnailCameraTransform.position; // Set position thumbnailCameraTransform.position = originalPosition + bounds.center; // Set size of camera to half of the highest value in the size vector of the ship thumbnailCamera.orthographicSize = highestval; // Take snapshot and destroy parent var texture = RTImage(thumbnailCamera); Destroy(parent.gameObject); thumbnailCameraTransform.position = originalPosition; // Create sprite return(Sprite.Create( texture, new Rect(0f, 0f, 800f, 800f), new Vector2(0.5f, 0.5f))); }
public BlueprintFactoryTests() { testee = new BlueprintFactory(new ItemRepository()); utilities = new BlueprintUtilities(); }
public BlueprintUtilitiesTests() { testee = new BlueprintUtilities(); }