Ejemplo n.º 1
0
    public void setAlpha(float alpha)
    {
        MeshRenderer[] children = GetComponentsInChildren <MeshRenderer>();
        Color          newColor;

        foreach (MeshRenderer child in children)
        {
            newColor             = child.material.color;
            newColor.a           = alpha;
            child.material.color = newColor;

            if (alpha == 1f)
            {
                MaterialExtensions.ToOpaqueMode(child.material);
            }
            else
            {
                MaterialExtensions.ToFadeMode(child.material);
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// shows / hides the classes game objects
    /// </summary>
    /// <param name="show">if true objs are shown, otherwise hidden</param>
    /// <param name="alpha">optional transpaceny</param>
    public void SetVisibility(bool show, float alpha = 1)
    {
        _visible = show;
        List <GameObject> models = new List <GameObject>(WheelchairModels);

        foreach (var model in models)
        {
            if (model != null)
            {
                model.SetActive(show);
            }
        }
        models.Add(UpperBody);
        models.Add(Legs);
        // if BioIK is needed for real roboy, only the meshes might need to be disabled, but for now just disable it all
        foreach (var obj in models)
        {
            if (obj == null)
            {
                continue;
            }
            foreach (var r in obj.GetComponentsInChildren <Renderer>())
            {
                r.enabled = show;
                if (alpha < 1)
                {
                    MaterialExtensions.ToFadeMode(r.material);
                }
                else
                {
                    MaterialExtensions.ToOpaqueMode(r.material);
                }
                Color color = r.material.color;
                color.a          = alpha;
                r.material.color = color;
            }
        }
    }
Ejemplo n.º 3
0
 public void SetMaterialRenderingModeToOpaque()
 {
     MaterialExtensions.ToOpaqueMode(tree);
     matcolor.a = 1f;
     tree.color = matcolor;
 }