void Start() { _modelUI = GetComponent <ConstructionEditorUI>(); _builder = ConstructionController.Instance.SetConstruction(constructionTarget); if (_builder == null) { _builder = ConstructionController.Instance.SetConstruction(xml.text, constructionTarget); } _builder.Init(ConstructionBuilder.BuilderType.Edit); foreach (Transform child in constructionTarget.transform) { LegoBrickId legoBrick = child.GetComponent <LegoBrickId>(); if (legoBrick != null) { _bricks.Add(legoBrick.id, legoBrick); } } selectedPart = null; UpdateAvailableParts(null); UpdateAvailableColors(null); }
public void DestroyTemporaryConstruction(Transform pContainer) { if (_builders.ContainsKey(pContainer)) { ConstructionBuilder builder = _builders[pContainer]; builder.Cleanup(); _builders.Remove(pContainer); } }
void SaveConstructionScreenshot(ConstructionBuilder builder, Transform constructTarget) { builder.SetConstructionPivot(ConstructionBuilder.ConstructionPivot.MiddleCenter); Vector3 pos = constructTarget.position; Quaternion rot = constructTarget.rotation; constructTarget.Translate(100f, 0f, 0f); ScreenshotCamera screenshot = FindObjectOfType <ScreenshotCamera>(); Assert.IsNotNull <ScreenshotCamera>(screenshot, "Screenshot Camera should not be null"); screenshot.TakeScreenshot(_numUserConstructions - 1); constructTarget.position = pos; constructTarget.rotation = rot; }
public void Init() { ConstructionBuilder builder = ConstructionController.Instance.SetConstruction(_constructionData.text, transform); builder.Init(ConstructionBuilder.BuilderType.Scan); builder.CreateBuilding(); FindObjectOfType <FakeExtrusionAnimation>().StartAnimation(builder); if (_dumpData) { _construction.Grid.Dump(); } }
bool SaveConstructionData(ConstructionBuilder builder) { string serialized = ConstructionSerializer.SerializeConstruction(builder.construction.GetAllBricks()); _numUserConstructions = PlayerPrefs.GetInt("numUserConstructions", 0); string constructionId = "construction_" + _numUserConstructions.ToString(); bool success = false; try{ PlayerPrefs.SetString(constructionId, serialized); success = true; }catch { Debug.LogError("Unable to save construction"); } if (success) { _numUserConstructions++; PlayerPrefs.SetInt("numUserConstructions", _numUserConstructions); } return(success); }
public void StartAnimation(ConstructionBuilder builder) { _builder = builder; _referencePoint = _builder.GetActualConstructionPivot(); StartCoroutine(ExtrusionAnimation()); }
public Client() { _builder = new BlockHouseBuilder(); }