diff --git a/Assets/Content/Scripts/PlayerVisual.cs b/Assets/Content/Scripts/PlayerVisual.cs index eb1d5d3..0ce82d3 100644 --- a/Assets/Content/Scripts/PlayerVisual.cs +++ b/Assets/Content/Scripts/PlayerVisual.cs @@ -50,7 +50,24 @@ public class PlayerVisual : MonoBehaviour public void RandomizeCustom() { - Debug.Log("randomize"); + float hueShift = Random.Range(0f, 360f); + + _customization.Colors = new Color[_references.Materials.Length]; + + for (int i = 0; i < _customization.Colors.Length; i++) + { + Material mat = _references.Materials[i]; + + Color col = mat.color; + if (mat.IsKeywordEnabled("_EMISSION")) + col = mat.GetColor("_EmissionColor"); + col = ShiftHue(col, hueShift); + + _customization.Colors[i] = col; + } + + SetCustom(); + SaveCustom(); } private void SetCustom()