Ejemplo n.º 1
0
    // Enabled btn
    public void GetMaterial(CustomColor c)
    {
        player.GetComponent <SpriteRenderer>().color = new Color32(
            c.GetComponent <CustomColor>().color.r,
            c.GetComponent <CustomColor>().color.g,
            c.GetComponent <CustomColor>().color.b,
            255);

        player.GetComponent <TrailRenderer>().startColor = new Color32(
            c.GetComponent <CustomColor>().color.r,
            c.GetComponent <CustomColor>().color.g,
            c.GetComponent <CustomColor>().color.b,
            255);

        player.GetComponent <TrailRenderer>().endColor = new Color32(
            c.GetComponent <CustomColor>().color.r,
            c.GetComponent <CustomColor>().color.g,
            c.GetComponent <CustomColor>().color.b,
            0);


        ColorTypeConverter col        = new ColorTypeConverter();
        string             colorSaved = col.ToRGBHex(c.GetComponent <CustomColor>().color);

        Debug.Log(colorSaved);
        // Save record
        PlayerPrefs.SetString("savecolor", colorSaved);
        PlayerPrefs.Save();
    }
Ejemplo n.º 2
0
    // Enabled btn
    public void GetMaterialGround(CustomColor c)
    {
        ground.GetComponent <SpriteRenderer>().color = new Color32(
            c.GetComponent <CustomColor>().color.r,
            c.GetComponent <CustomColor>().color.g,
            c.GetComponent <CustomColor>().color.b,
            255);

        ColorTypeConverter col        = new ColorTypeConverter();
        string             colorSaved = col.ToRGBHex(ground.GetComponent <SpriteRenderer>().color);

        // Save record
        PlayerPrefs.SetString("savecolorground", colorSaved);
        PlayerPrefs.Save();
    }