Ejemplo n.º 1
0
		public override void Setup()
		{
			base.Setup();

			EntityManager.CreateEntity(EntityGroups.GetValue(new ByteFlag(1)));
			EntityManager.CreateEntity(EntityGroups.GetValue(new ByteFlag(1, 2)));
			EntityManager.CreateEntity(EntityGroups.GetValue(new ByteFlag(2)));
			EntityManager.CreateEntity(EntityGroups.GetValue(new ByteFlag(2, 3)));
			EntityManager.CreateEntity(EntityGroups.GetValue(new ByteFlag(3)));
		}
Ejemplo n.º 2
0
		public void GroupChangeUpdate()
		{
			var entity = EntityManager.CreateEntity(EntityGroups.GetValue(new ByteFlag(1, 2, 3)));
			var entityGroup = EntityManager.Entities.Filter(EntityGroups.GetValue(new ByteFlag(1, 2)), EntityMatches.All);

			Assert.That(entityGroup.Count, Is.EqualTo(2));

			entity.Groups = EntityGroups.Nothing;

			Assert.That(entityGroup.Count, Is.EqualTo(1));
		}
Ejemplo n.º 3
0
        public void GroupSendMessage()
        {
            var entity      = EntityManager.CreateEntity(EntityGroups.GetValue(new ByteFlag(1, 2, 3)));
            var component1  = Substitute.For <DummyComponent1>();
            var component2  = Substitute.For <DummyComponent2>();
            var entityGroup = EntityManager.Entities.Filter(EntityGroups.GetValue(new ByteFlag(1, 2)), EntityMatches.All);

            entity.Add(component1);
            entity.Add(component2);
            entityGroup.BroadcastMessage(0);

            component1.Received(1).MessageNoArgument();
            component1.Received(1).OnMessage(0);
            component2.Received(1).MessageNoArgument();
            component2.Received(1).OnMessage(0);
        }
Ejemplo n.º 4
0
		public void GroupMatchAll()
		{
			var entityGroup = EntityManager.Entities.Filter(EntityGroups.GetValue(new ByteFlag(1)), EntityMatches.All);

			Assert.That(entityGroup.Count, Is.EqualTo(2));
		}