/// <summary> /// Copy a component value to another component array /// </summary> /// <param name="source">The source index from our array</param> /// <param name="other">The other array where values will be copied to</param> /// <param name="destination">The destination index of the other array</param> public void CopyTo(int source, ComponentArray other, int destination) { if (other.Type != Type) { throw new InvalidOperationException("not the same type"); } wrapped.CopyTo(source, other.wrapped, destination); }
/// <summary> /// Copy the values to another array (if the length match) /// </summary> /// <param name="other"></param> /// <exception cref="InvalidOperationException"></exception> public void CopyTo(ComponentArray other) { if (other.Type != Type) { throw new InvalidOperationException("not the same type"); } if (other.Length != Length) { throw new InvalidOperationException("the length does not match"); } wrapped.CopyTo(other.wrapped); }
public RevolutionChunk(IEnumerable <Type> components) { ComponentTypes = components.ToArray(); entities = new PooledList <RawEntity>(); Components = new PooledDictionary <Type, ComponentArray>(ComponentTypes.Length); foreach (var type in ComponentTypes) { Components[type] = new ComponentArray(type); } entityToIndex = new PooledDictionary <RawEntity, int>(); updateEntityIndex = i => entityToIndex[entities[i]] = i; }