Esempio n. 1
0
 public void ChangeColor(AssociatedColor associated)
 {
     if (Input.touchCount > 1)
     {
         return;
     }
     _levelProgression.CurrentColor = associated.Color;
     GetShapePointsSpline.instance.needleAnimator.enabled = true;
     //_levelProgression.IsPainting = true;
 }
Esempio n. 2
0
    public void ListenToReference(LevelReference currentLevelReference)
    {
        _levelProgression.Color_Changed += OnColorChanging;
        foreach (var item in _levelReference.RefColorsWithPercents)
        {
            _levelColors.Add(new ColorAndPercent(item));
        }

        _levelProgression.ColorAndPercents.Clear();
        _levelProgression.StarsCount = -1;
        _levelProgression.Progress   = 0;
        _modelMeshFilter.mesh        = currentLevelReference.Mesh;
        _ghostMeshFiler.mesh         = currentLevelReference.Mesh;
        _levelProgression.IsPainting = false;
        OnColorChanging(new ColorAndPercent(_levelReference.RefColorsWithPercents[0]));

        if (_levelColors.Count != _levelButtons.Count)
        {
            Debug.LogError("Match Level Colors and Level Buttons count to begin game, D-Head");
            return;
        }

        foreach (ColorAndPercent item in _levelColors)
        {
            item.color.a       = 1f;
            item.percent       = 0f;
            item.pixelsCounter = 0f;
            item.compared      = false;
            _levelProgression.ColorAndPercents.Add(item);
        }

        int counter = _levelColors.Count;

        for (int i = 0; i < counter; i++)
        {
            AssociatedColor associated = _levelButtons[i].gameObject.GetComponent <AssociatedColor>();

            if (associated == null)
            {
                _levelButtons[i].gameObject.AddComponent <AssociatedColor>().Color = _levelColors[i].color;
            }
            else
            {
                associated.Color = _levelColors[i].color;
            }
        }

        _myTex = TransferAlpha(_modelTex);
        //_uvFilledPoints = _modelUVFilled.UVs;
        //_mappedPoints = _modelUVFilled.MappedPoints;
        _mappedPoints = GetModelWorldPositionPointsBasedOnKnittingSpeed(_modelMeshFilter, _myTex, _knittingStep, _knittingHeight);
        if (_mappedPoints == null)
        {
            return;
        }
        _mappedPointsMax     = _mappedPoints.Count;
        _mappedPointsCounter = 0;

        _material.mainTexture = _myTex;
        ManipulateAlpha(_myTex, 0f);
    }