protected virtual void Update() { var finalCounters = counters.Count > 0 ? counters : null; var total = P3dChannelCounter.GetTotal(finalCounters); var count = default(long); switch (channel) { case ChannelType.Red: count = P3dChannelCounter.GetCountR(finalCounters); break; case ChannelType.Green: count = P3dChannelCounter.GetCountG(finalCounters); break; case ChannelType.Blue: count = P3dChannelCounter.GetCountB(finalCounters); break; case ChannelType.Alpha: count = P3dChannelCounter.GetCountA(finalCounters); break; } if (inverse == true) { count = total - count; } var final = format; var percent = P3dHelper.RatioToPercentage(P3dHelper.Divide(count, total), decimalPlaces); final = final.Replace("{TOTAL}", total.ToString()); final = final.Replace("{COUNT}", count.ToString()); final = final.Replace("{PERCENT}", percent.ToString()); cachedText.text = final; }
protected virtual void FixedUpdate() { var ratioRGBA = P3dChannelCounter.GetRatioRGBA(); var amount = 1f; switch (channel) { case ChannelType.Red: amount = ratioRGBA.x; break; case ChannelType.Green: amount = ratioRGBA.y; break; case ChannelType.Blue: amount = ratioRGBA.z; break; case ChannelType.Alpha: amount = ratioRGBA.w; break; } cachedImage.fillAmount = Mathf.Clamp01(amount); }
protected virtual void Update() { var finalCounters = counters.Count > 0 ? counters : null; switch (output) { case OutputType.Percentage: { var ratios = P3dChannelCounter.GetRatioRGBA(finalCounters); switch (channel) { case ChannelType.Red: OutputRatio(ratios.x); break; case ChannelType.Green: OutputRatio(ratios.y); break; case ChannelType.Blue: OutputRatio(ratios.z); break; case ChannelType.Alpha: OutputRatio(ratios.w); break; case ChannelType.InverseAlpha: OutputRatio(1.0f - ratios.w); break; } } break; case OutputType.Pixels: { switch (channel) { case ChannelType.Red: OutputSolid(P3dChannelCounter.GetSolidR(finalCounters)); break; case ChannelType.Green: OutputSolid(P3dChannelCounter.GetSolidG(finalCounters)); break; case ChannelType.Blue: OutputSolid(P3dChannelCounter.GetSolidB(finalCounters)); break; case ChannelType.Alpha: OutputSolid(P3dChannelCounter.GetSolidA(finalCounters)); break; case ChannelType.InverseAlpha: OutputSolid(P3dChannelCounter.GetTotal(finalCounters) - P3dChannelCounter.GetSolidA(finalCounters)); break; } } break; } }
protected virtual void Update() { var finalCounters = counters.Count > 0 ? counters : null; var ratioRGBA = P3dChannelCounter.GetRatioRGBA(finalCounters); var amount = 0.0f; switch (channel) { case ChannelType.Red: amount = ratioRGBA.x; break; case ChannelType.Green: amount = ratioRGBA.y; break; case ChannelType.Blue: amount = ratioRGBA.z; break; case ChannelType.Alpha: amount = ratioRGBA.w; break; case ChannelType.InverseAlpha: amount = 1.0f - ratioRGBA.w; break; } cachedImage.fillAmount = Mathf.Clamp01(amount); }
protected virtual void Update() { var finalCounters = counters.Count > 0 ? counters : null; var ratio = 0.0f; switch (channel) { case ChannelType.Red: ratio = P3dChannelCounter.GetRatioR(finalCounters); break; case ChannelType.Green: ratio = P3dChannelCounter.GetRatioG(finalCounters); break; case ChannelType.Blue: ratio = P3dChannelCounter.GetRatioB(finalCounters); break; case ChannelType.Alpha: ratio = P3dChannelCounter.GetRatioA(finalCounters); break; } if (inverse == true) { ratio = 1.0f - ratio; } cachedImage.fillAmount = Mathf.Clamp01(ratio); }
protected virtual void Update() { switch (output) { case OutputType.Percentage: { var ratios = P3dChannelCounter.GetRatioRGBA(); switch (channel) { case ChannelType.Red: OutputRatio(ratios.x); break; case ChannelType.Green: OutputRatio(ratios.y); break; case ChannelType.Blue: OutputRatio(ratios.z); break; case ChannelType.Alpha: OutputRatio(ratios.w); break; } } break; case OutputType.Pixels: { switch (channel) { case ChannelType.Red: OutputSolid(P3dChannelCounter.GetSolidR()); break; case ChannelType.Green: OutputSolid(P3dChannelCounter.GetSolidG()); break; case ChannelType.Blue: OutputSolid(P3dChannelCounter.GetSolidB()); break; case ChannelType.Alpha: OutputSolid(P3dChannelCounter.GetSolidA()); break; } } break; } }