Files
crtr/Assets/Cryville/Crtr/Components/SpriteRect.cs
2022-09-30 18:19:19 +08:00

34 lines
618 B
C#

using UnityEngine;
namespace Cryville.Crtr.Components {
public class SpriteRect : SpriteBase {
public SpriteRect() {
SubmitProperty("color", new PropOp.Color(v => Color = v));
transparent = true;
}
Color _color;
public Color Color {
get { return _color; }
set {
_color = value;
OnColorUpdate();
}
}
void OnColorUpdate() {
if (!mesh.Initialized) return;
mesh.Renderer.material.SetColor("_Color", _color);
}
protected override Vector3 BaseScale {
get { return Vector3.one; }
}
public override void Init() {
InternalInit();
OnColorUpdate();
}
}
}