コード例 #1
0
        public void SetAsParentOf_Should_set_created_entity_as_child()
        {
            using EntityCommandRecorder recorder = new EntityCommandRecorder(1024);
            using World world = new World();

            Entity child = world.CreateEntity();

            EntityRecord record = recorder.CreateEntity();

            record.SetAsParentOf(recorder.Record(child));

            recorder.Execute(world);

            Check.That(world.Skip(1).Single().GetChildren()).Contains(child);
        }
コード例 #2
0
        public void SetAsParentOf_Should_set_recorded_entity_as_parent()
        {
            using (EntityCommandRecorder recorder = new EntityCommandRecorder(1024))
                using (World world = new World())
                {
                    Entity child  = world.CreateEntity();
                    Entity entity = world.CreateEntity();

                    EntityRecord record = recorder.Record(entity);
                    record.SetAsParentOf(recorder.Record(child));

                    recorder.Execute(world);

                    Check.That(entity.GetChildren()).Contains(child);
                }
        }
コード例 #3
0
        public void RemoveFromParentsOf_Should_set_created_entity_as_child()
        {
            using (EntityCommandRecorder recorder = new EntityCommandRecorder(1024))
                using (World world = new World())
                {
                    Entity child = world.CreateEntity();

                    EntityRecord childRecord = recorder.Record(child);
                    EntityRecord record      = recorder.CreateEntity();
                    record.SetAsParentOf(childRecord);
                    record.RemoveFromParentsOf(childRecord);

                    recorder.Execute(world);

                    Check.That(world.GetAllEntities().Skip(1).Single().GetChildren()).IsEmpty();
                }
        }