remove ToColor32

This commit is contained in:
JohnCorby 2022-05-24 10:44:51 -07:00
parent cb1c3891fa
commit 73b03a3557
4 changed files with 7 additions and 10 deletions

View File

@ -44,7 +44,7 @@ namespace NewHorizons.Builder.Atmosphere
var cloudMaterial = new Material(gdRuleset._cloudMaterial); var cloudMaterial = new Material(gdRuleset._cloudMaterial);
if (config.Atmosphere?.clouds?.tint != null) if (config.Atmosphere?.clouds?.tint != null)
{ {
cloudMaterial.SetColor(FogColor, config.Atmosphere.clouds.tint.ToColor32()); cloudMaterial.SetColor(FogColor, config.Atmosphere.clouds.tint.ToColor());
} }
ER._cloudMaterial = cloudMaterial; ER._cloudMaterial = cloudMaterial;

View File

@ -24,8 +24,8 @@ namespace NewHorizons.Builder.Body
new Material(sandMaterials[1]) new Material(sandMaterials[1])
}; };
GameObject.Destroy(oldMR); GameObject.Destroy(oldMR);
sandMR.sharedMaterials[0].color = module.Tint.ToColor32(); sandMR.sharedMaterials[0].color = module.Tint.ToColor();
sandMR.sharedMaterials[1].color = module.Tint.ToColor32(); sandMR.sharedMaterials[1].color = module.Tint.ToColor();
} }
var collider = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/Collider"), sandGO.transform); var collider = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/Collider"), sandGO.transform);

View File

@ -57,13 +57,13 @@ namespace NewHorizons.Builder.Orbital
} }
var color = Color.white; var color = Color.white;
if (config.Orbit.tint != null) color = config.Orbit.tint.ToColor32(); if (config.Orbit.tint != null) color = config.Orbit.tint.ToColor();
else if (config.Star != null) color = config.Star.tint.ToColor32(); else if (config.Star != null) color = config.Star.tint.ToColor();
else if (config.Atmosphere?.clouds?.tint != null) color = config.Atmosphere.clouds.tint.ToColor32(); else if (config.Atmosphere?.clouds?.tint != null) color = config.Atmosphere.clouds.tint.ToColor();
else if (config.Singularity != null) color = new Color(1f, 0.5f, 1f); else if (config.Singularity != null) color = new Color(1f, 0.5f, 1f);
else if (config.Water != null) color = new Color(0.5f, 0.5f, 1f); else if (config.Water != null) color = new Color(0.5f, 0.5f, 1f);
else if (config.Lava != null) color = new Color(1f, 0.5f, 0.5f); else if (config.Lava != null) color = new Color(1f, 0.5f, 0.5f);
else if (config.Atmosphere != null && config.Atmosphere.fogTint != null) color = config.Atmosphere.fogTint.ToColor32(); else if (config.Atmosphere != null && config.Atmosphere.fogTint != null) color = config.Atmosphere.fogTint.ToColor();
var fade = isMoon; var fade = isMoon;

View File

@ -39,9 +39,6 @@ namespace NewHorizons.Utility
[DefaultValue(255f)] [DefaultValue(255f)]
public int a; public int a;
public Color32 ToColor32() => new Color32((byte)r, (byte)g, (byte)b, (byte)a);
public Color ToColor() => new Color(r / 255f, g / 255f, b / 255f, a / 255f); public Color ToColor() => new Color(r / 255f, g / 255f, b / 255f, a / 255f);
public static implicit operator Color(MColor c) => new Color(c.r / 255f, c.g / 255f, c.b / 255f, c.a / 255f);
} }
} }