Pull up mesh.color. Remove *.opacity properties.

This commit is contained in:
2023-02-19 22:06:20 +08:00
parent a115999aab
commit ba3238614b
6 changed files with 20 additions and 53 deletions

View File

@@ -4,6 +4,7 @@ using UnityEngine;
namespace Cryville.Crtr.Components {
public abstract class MeshBase : SkinComponent {
public MeshBase() {
SubmitProperty("color", new PropOp.Color(v => Color = v));
SubmitProperty("zindex", new PropOp.Integer(v => ZIndex = (short)v));
}
@@ -28,6 +29,22 @@ namespace Cryville.Crtr.Components {
mat.renderQueue = _zindex;
}
}
Color _color = Color.white;
public Color Color {
get { return _color; }
set {
_color = value;
UpdateColor();
}
}
protected void UpdateColor() {
if (!mesh.Initialized) return;
foreach (var mat in materials) {
mat.color = _color;
}
}
protected override void OnDestroy() {
if (materials != null)
foreach (var mat in materials) {