Пример #1
0
    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);
    }
Пример #2
0
 public void DestroyTemporaryConstruction(Transform pContainer)
 {
     if (_builders.ContainsKey(pContainer))
     {
         ConstructionBuilder builder = _builders[pContainer];
         builder.Cleanup();
         _builders.Remove(pContainer);
     }
 }
Пример #3
0
    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;
    }
Пример #4
0
    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();
        }
    }
Пример #5
0
    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());
 }
Пример #7
0
 public Client()
 {
     _builder = new BlockHouseBuilder();
 }