Exemple #1
0
        public void BehaviorPack_AttachChildrenOnFirstUpdate()
        {
            var holder = new BehaviorHolder(new LivingConcrete());

            var pack = new BehaviorPack(new List <Behavior>()
            {
                new WaitBehavior(1),
                new WaitBehavior(1),
                new WaitBehavior(1),
            });

            holder.Attach(pack);
            holder.Update(0.001f);
            Assert.AreEqual(3, holder.AliveCount);
        }
Exemple #2
0
        public void BehaviorHolder_UpdateBasicTest()
        {
            var holder = new BehaviorHolder(new LivingConcrete());

            int count = 0;

            var beh = new WaitBehavior(2);

            holder.Attach(beh);

            beh = new WaitBehavior(3);
            holder.Attach(beh);

            while (holder.HasAliveBehaviors)
            {
                holder.Update(1);
                count++;
            }

            // Behaviors are granted one last update after they are killed
            Assert.AreEqual(4, count);
        }
Exemple #3
0
        protected override void OnUpdate(float delta)
        {
            _holder.Update(delta);

            base.OnUpdate(delta);
        }