Пример #1
0
 /// <summary>
 /// 生きている子カウンタ or nullに行きつくまで子カウンタを退ける.
 /// </summary>
 public void RemoveDeadChilds()
 {
     while (child != null && !child.IsLiving)
     {
         this.child = child.child;
     }
 }
        public void When_Cloned_Expires_Is_Copied()
        {
            var invoker = new Mock<ISubdocInvoker>();
            var builder = new MutateInBuilder<dynamic>(invoker.Object, () => new DefaultSerializer(), "key",
                new List<OperationSpec> { new OperationSpec() });

            var op = new SubCounter<dynamic>(builder, "key", null, new DefaultTranscoder(), 0)
            {
                Expires = 10
            };

            Assert.AreEqual(10, op.Expires);
            var cloned = op.Clone() as SubCounter<dynamic>;
            Assert.AreEqual(10, cloned.Expires);
        }
Пример #3
0
        public uint CalcSeedBeforeEntryingBattle(uint seed)
        {
            // 戦闘突入時のエフェクトで4消費. 諸悪の根源.
            seed.Advance(4);

            // 遅延で生える処理をシミュレート.
            var lazy           = lazyGenerators.Count(_ => _.CountDown().IsZero);
            var newSubCounters = new SubCounter[lazy];

            for (int i = 0; i < newSubCounters.Length; i++)
            {
                newSubCounters[i] = new SubCounter(ref seed);
            }

            mainCounters[0].SimulateCountUp(ref seed, newSubCounters);
            mainCounters[1].SimulateCountUp(ref seed);
            mainCounters[2].SimulateCountUp(ref seed);
            mainCounters[3].SimulateCountUp(ref seed);
            mainCounters[4].SimulateCountUp(ref seed);
            mainCounters[5].SimulateCountUp(ref seed);

            return(seed);
        }
Пример #4
0
 /// <summary>
 /// 子カウンタを挟みこみます.
 /// </summary>
 /// <param name="newChild"></param>
 public void InterruptChild(SubCounter newChild)
 {
     newChild.child = this.child;
     this.child     = newChild;
 }
Пример #5
0
 public MainCounter(float init = INITIAL_VALUE)
 {
     value      = init;
     subCounter = new SubCounter();
 }