示例#1
0
 public void SetColorFromPalette(int colorId, CellAnimationType _animationType = CellAnimationType.None)
 {
     if (_coloringCoroutine != null)
     {
         StopCoroutine(_coloringCoroutine);
     }
     _coloringCoroutine = StartCoroutine(ColoringCoroutine(colorId, _animationType));
 }
示例#2
0
    private IEnumerator ColoringCoroutine(int colorId, CellAnimationType _animationType)
    {
        if (_animationType == CellAnimationType.None)
        {
            currentColor = colorId;
            SetColor(Gameplay.ColorPalette[currentColor]);
            yield break;
        }
        else if (_animationType == CellAnimationType.ToColor)
        {
            currentColor = colorId;
            _cellImage.DOColor(Gameplay.ColorPalette[currentColor], Gameplay.ANIMATION_TIME);
        }
        else if (_animationType == CellAnimationType.ToColorAndBack)
        {
            _cellImage.DOColor(Gameplay.ColorPalette[colorId], Gameplay.ANIMATION_TIME);
            yield return(new WaitForSeconds(Gameplay.ANIMATION_TIME));

            _cellImage.DOColor(Gameplay.ColorPalette[currentColor], Gameplay.ANIMATION_TIME);
        }


        yield return(null);
    }