示例#1
0
    public void Refresh(GameColor color, bool animate = true)
    {
        Color newCurrentColor = _colorsManager.GetColor(color);
        Color newNextColor    = _colorsManager.GetColor(_colorsManager.GetNextColor(color));

        if (animate)
        {
            iTween.ValueTo(gameObject, iTween.Hash(
                               "from", _currentColorImage.color,
                               "to", newCurrentColor,
                               "onupdate", "SetCurrentColorImageColor",
                               "time", 1.0f,
                               "easetype", iTween.EaseType.easeOutCubic
                               ));
            iTween.ValueTo(gameObject, iTween.Hash(
                               "from", _nextColorImage.color,
                               "to", newNextColor,
                               "onupdate", "SetNextColorImageColor",
                               "time", 1.0f,
                               "easetype", iTween.EaseType.easeOutCubic
                               ));
        }
        else
        {
            _currentColorImage.color = newCurrentColor;
            _nextColorImage.color    = newNextColor;
        }
    }
示例#2
0
 /// <summary>
 /// Change the color of this game object
 /// </summary>
 public bool SetColor(GameColor newColor, bool animation = true)
 {
     if (!CanChangeColor(newColor))
     {
         return(false);
     }
     _previousColor   = _color;
     _color           = newColor;
     gameObject.layer = _colorsManager.GetLayer(this._color);
     if (animation)
     {
         colorAnimationManager.StartAnimation();
     }
     else
     {
         DoUpdateColor(_colorsManager.GetColor(Color));
     }
     return(true);
 }
    public void OnPlayerChangeColor(PlayerChangedColorSignal signal)
    {
        if (signal.oldColor == GameColor.NONE)
        {
            return;
        }
        Color startColor = _colorsManager.GetColor(signal.newColor);

        ParticleSystem.MainModule mainModule = _particleSystem.main;
        mainModule.startColor = new ParticleSystem.MinMaxGradient(startColor);
        _particleSystem.Stop(true, ParticleSystemStopBehavior.StopEmitting);
        _particleSystem.Play();
    }