예제 #1
0
 /// <summary>
 /// Resets the component.
 /// This is the preferred method to use when
 /// resetting a component to its original state when first added.
 /// </summary>
 /// <param name="componentType">The component base type.</param>
 /// <param name="args"></param>
 public void ResetComponent(ComponentType componentType, params object[] args)
 {
     this.entityManager.ResetComponent(this, componentType);
 }
예제 #2
0
        /// <summary>
        ///   Marks the component to remove. The actual removal is deferred and will happen in the next EntityWorld update.
        ///   Faster removal of components from a entity.
        /// </summary>
        /// <param name="componentType">The type.</param>
        public void RemoveComponent(ComponentType componentType)
        {
            Debug.Assert(componentType != null, "Component type must not be null.");

            this.entityManager.RemoveComponent(this, componentType);
        }
 /// <summary>
 /// Sets the Type for specified ComponentType.
 /// </summary>
 /// <param name="type">The type being set.</param>
 /// <param name="componentType">The component type.</param>
 internal static void SetTypeFor(Type type, ComponentType componentType)
 {
     ComponentTypes.Add(type, componentType);
 }
예제 #4
0
        /// <summary>
        /// Gets the component.
        /// Slower retrieval of components from this entity.
        /// Minimize usage of this, but is fine to use e.g. when
        /// creating new entities and setting data in components.
        /// </summary>
        /// <param name="componentType">Type of the component.</param>
        /// <returns>component that matches, or null if none is found.</returns>
        public IEntityComponent GetComponent(ComponentType componentType)
        {
            Debug.Assert(componentType != null, "Component type must not be null.");

            return(this.entityManager.GetComponent(this, componentType));
        }
 /// <summary>
 /// Sets the type for specified ComponentType T.
 /// </summary>
 /// <typeparam name="T">The <see langword="Type" /> of T being set.</typeparam>
 /// <param name="componentType">The component type.</param>
 internal static void SetTypeFor <T>(ComponentType componentType)
 {
     ComponentTypes.Add(typeof(T), componentType);
 }