void Update() { if (Card.Mode != scratchMode) { scratchMode = Card.Mode; ResetProgress(); } if (Card.IsScratching && !isCompleted) { UpdateProgress(); } }
void Awake() { scratchMode = Card.Mode; commandBuffer = new CommandBuffer(); commandBuffer.name = "EraseProgress"; CreateRenderTexture(); rti = new RenderTargetIdentifier(renderPercent); mesh = new Mesh(); mesh.vertices = new[] { new Vector3(0, 0, 0), new Vector3(0, 1, 0), new Vector3(1, 1, 0), new Vector3(1, 0, 0), }; mesh.uv = new[] { new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), }; mesh.triangles = new[] { 0, 1, 2, 2, 3, 0 }; mesh.colors = new[] { Color.white, Color.white, Color.white, Color.white }; }