コード例 #1
0
        protected override void Update()
        {
            if (!increasing)
            {
                cycleTimer -= Time.SecScaled;
                if (cycleTimer < 0)
                {
                    cycleTimer = 0;
                    increasing = true;
                }
            }
            else
            {
                cycleTimer += Time.SecScaled;
                if (cycleTimer > CyclePeriod)
                {
                    cycleTimer = CyclePeriod;
                    increasing = false;
                }
            }
            var alphaRange = MaxAlpha - MinAlpha;
            var cycle      = MathHelper.Lerp(0, CyclePeriod, cycleTimer);

            image.SetAlpha(MinAlpha + (alphaRange * (cycle / CyclePeriod)));
        }