Пример #1
0
    //初始化克隆材质球,并赋予所有子对象
    private Material initMaterial(GameObject go)
    {
        if (null != go)
        {
            Material tempMaterial = MaterialUtils.cloneMaterial(go, MaterialUtils.SHIP_SHADER_NAME);
            if (tempMaterial != null)
            {
                //按玩家配置修改色相
                tempMaterial.SetFloat("_Hue", _shipHue);
                tempMaterial.SetFloat("_Saturation", _shipSaturation);
                tempMaterial.SetFloat("_Value", _shipValue);
                tempMaterial.SetColor("_Blue", _passAColor);
                tempMaterial.SetColor("_Green", _passBColor);
                tempMaterial.SetColor("_Red", _passCColor);

                MaterialUtils.setMaterial(go, tempMaterial);
            }
            return(tempMaterial);
        }
        else
        {
            return(null);
        }
    }