Пример #1
0
	    public void ReadOnlyDynamicBufferImpl(bool readOnlyType)
	    {
	        var original = m_Manager.CreateEntity(typeof(EcsIntElement));
	        var buffer = m_Manager.GetBuffer<EcsIntElement>(original);
	        buffer.Add(5);

	        var group = EmptySystem.GetComponentGroup(new EntityArchetypeQuery {All = new ComponentType[] {typeof(EcsIntElement)}});
	        var job = new ReadOnlyJob
            {
                Int = EmptySystem.GetArchetypeChunkBufferType<EcsIntElement>(readOnlyType)
            };
        
            job.Schedule(group).Complete();
	    }
Пример #2
0
	    public void ReadWriteDynamicBuffer()
	    {
	        var original = m_Manager.CreateEntity(typeof(EcsIntElement));
	        var buffer = m_Manager.GetBuffer<EcsIntElement>(original);
	        buffer.Add(5);

	        var group = EmptySystem.GetComponentGroup(new EntityArchetypeQuery {All = new ComponentType[] {typeof(EcsIntElement)}});
	        var job = new WriteJob
	        {
	            //@TODO: Throw exception when read only flag is not accurately passed to job for buffers...
	            Int = EmptySystem.GetArchetypeChunkBufferType<EcsIntElement>()
	        };
        
	        job.Schedule(group).Complete();
	    }
Пример #3
0
        public void ReadOnlyDynamicBufferImpl(bool readOnlyType)
        {
            // Create multiple chunks so we ensure we are doing parallel for reading from buffers
            for (int i = 0; i != 10; i++)
            {
                var original = m_Manager.CreateEntity(typeof(EcsIntElement));
                m_Manager.AddSharedComponentData(original, new SharedData1(i));
                var buffer = m_Manager.GetBuffer <EcsIntElement>(original);
                buffer.Add(5);
            }

            var group = EmptySystem.GetEntityQuery(new EntityQueryDesc {
                All = new ComponentType[] { typeof(EcsIntElement) }
            });
            var job = new ReadOnlyJob
            {
                Int = EmptySystem.GetArchetypeChunkBufferType <EcsIntElement>(readOnlyType)
            };

            job.Schedule(group).Complete();
        }