예제 #1
0
        /// <summary>Initializes a new instance of the <see cref="ComponentType"/> class.</summary>
        internal ComponentType()
        {
            #if XBOX || WINDOWS_PHONE || PORTABLE || FORCEINT32
            if (nextId == 64)
            {
                // nextBit has overflown and is 0 now
                throw new InvalidOperationException("Distinct ComponentType limit reached: number of ComponentType types is restricted to 32 in the current Artemis build.");
            }
            #endif

            this.Id = nextId;
            this.Bit = nextBit;

            nextId++;
            nextBit <<= 1;
        }
예제 #2
0
 /// <summary>Appends the types.</summary>
 /// <param name="builder">The builder.</param>
 /// <param name="headerMessage">The header message.</param>
 /// <param name="typeBits">The type bits.</param>
 private static void AppendTypes(StringBuilder builder, string headerMessage, BigInteger typeBits)
 {
     if (typeBits != 0)
     {
         builder.AppendLine(headerMessage);
         foreach (Type type in ComponentTypeManager.GetTypesFromBits(typeBits))
         {
             builder.Append(", ");
             builder.AppendLine(type.Name);
         }
     }
 }
예제 #3
0
 /// <summary>Initializes static members of the <see cref="ComponentType"/> class.</summary>
 static ComponentType()
 {
     nextBit = 1;
     nextId = 0;
 }
예제 #4
0
        /// <summary>Gets the one.</summary>
        /// <param name="types">The types.</param>
        /// <returns>The specified Aspect.</returns>
        public Aspect GetOne(params Type[] types)
        {
            Debug.Assert(types != null, "Types must not be null.");

            foreach (ComponentType componentType in types.Select((a) => ComponentTypeManager.GetTypeFor(a)))
            {
                this.OneTypesMap |= componentType.Bit;
            }

            return this;
        }