Example #1
0
    public void ChangeColor(ColorUtil.Colors newColor)
    {
        _currentColor = newColor;
        _colorChanger.ChangeColor(_currentColor);
        Animator animator = GetComponent <Animator>();

        string color = _currentColor.ToString();

        foreach (string item in Enum.GetNames(typeof(ColorUtil.Colors)))
        {
            if (item != color)
            {
                animator.SetBool(item, false);
            }
            else
            {
                animator.SetBool(item, true);
            }
        }
        _gui.color = ColorUtil.UnityColorFromColorEnum(_currentColor);
        _muzzleFlash.ChangeColor(_currentColor);
    }