void SetDefaultColor()
    {
        int colorNdx = s_colorCount++;

        // Pick a color
        float hue = (((colorNdx & 0x01) << 5) |
                     ((colorNdx & 0x02) << 3) |
                     ((colorNdx & 0x04) << 1) |
                     ((colorNdx & 0x08) >> 1) |
                     ((colorNdx & 0x10) >> 3) |
                     ((colorNdx & 0x20) >> 5)) / 64.0f;
        float sat   = (colorNdx & 0x10) != 0 ? 0.5f : 1.0f;
        float value = (colorNdx & 0x20) != 0 ? 0.5f : 1.0f;
        float alpha = 1.0f;

        Vector4 hsva = new Vector4(hue, sat, value, alpha);

        color = HFTColorUtils.HSVAToColor(hsva);
    }
    void SetColor(int colorNdx)
    {
        // Pick a color
        float hueAdjust = (((colorNdx & 0x01) << 5) |
                           ((colorNdx & 0x02) << 3) |
                           ((colorNdx & 0x04) << 1) |
                           ((colorNdx & 0x08) >> 1) |
                           ((colorNdx & 0x10) >> 3) |
                           ((colorNdx & 0x20) >> 5)) / 64.0f;
        float valueAdjust = (colorNdx & 0x20) != 0 ? -0.5f : 0.0f;
        float satAdjust   = (colorNdx & 0x10) != 0 ? -0.5f : 0.0f;

        // get the hsva for the baseColor
        Vector4 hsva = HFTColorUtils.ColorToHSVA(baseColor);

        // adjust that base color by the amount we picked
        hsva.x += hueAdjust;
        hsva.y += satAdjust;
        hsva.z += valueAdjust;

        // now get the adjusted color.
        Color playerColor = HFTColorUtils.HSVAToColor(hsva);

        // Tell the gamepad to change color
        m_gamepad.color = playerColor;

        // Create a 1 pixel texture for the OnGUI code to draw the label
        Color[] pix = new Color[1];
        pix[0] = playerColor;
        Texture2D tex = new Texture2D(1, 1);

        tex.SetPixels(pix);
        tex.Apply();
        m_guiStyle.normal.background = tex;

        // Set the HSVA material of the character to the color adjustments.
        m_material.SetVector("_HSVAAdjust", new Vector4(hueAdjust, satAdjust, valueAdjust, 0.0f));
    }