示例#1
0
        /// <summary>
        /// 瞬きを行うseedと前回の瞬きからの間隔と消費数のTupleを返し続けます.
        /// </summary>
        /// <param name="seed"></param>
        /// <param name="coolTime"></param>
        /// <returns></returns>
        public static IEnumerable <(uint seed, int interval, int frame, uint lcgIndex)> EnumerateBlinkingSeed(this uint seed, int coolTime = 4)
        {
            var  lastBlinkedFrame = 0;
            var  obj   = new BlinkObject(coolTime, 1);
            uint index = 0;

            for (var currentFrame = 1; true; currentFrame++)
            {
                if (index == 0xFFFFFFFF)
                {
                    yield break;
                }
                if (obj.CountUp(ref seed, ref index))
                {
                    yield return(seed, currentFrame - lastBlinkedFrame, currentFrame, index);

                    lastBlinkedFrame = currentFrame;
                }
            }
        }
示例#2
0
        public static IEnumerable <(uint seed, int interval, int frame, uint lcgIndex)> EnumerateBlinkingSeedInBattle(this uint seed, int coolTime = 4, bool enemyBlinking = false)
        {
            var  lastBlinkedFrame = 0;
            var  player           = new BlinkObject(10);
            var  enemy            = new BlinkObject(10);
            var  obj   = new BlinkObject(coolTime);
            uint index = 0;

            for (var currentFrame = 1; true; currentFrame++)
            {
                player.CountUp(ref seed, ref index);
                if (enemyBlinking)
                {
                    enemy.CountUp(ref seed, ref index);
                }
                if (obj.CountUp(ref seed, ref index))
                {
                    yield return(seed, currentFrame - lastBlinkedFrame, currentFrame, index);

                    lastBlinkedFrame = currentFrame;
                }
            }
        }