-
Notifications
You must be signed in to change notification settings - Fork 1
Entity
An Entity is just a list of components and a "tag" (an identifier used to tell entities apart). Entities should never update or draw their components directly, this should be done through Systems.
Checks if this already has "component". If it does, throws a ComponentAlreadyExistsException. Otherwise, add the component to "Components", and fire the ComponentAdded event (if it's also not null).
Returns the component you just added (¯_(ツ)_/¯)
Removes "component" if it isn't null and "this" contains the component.
Checks through Components for a component of type "T". If it doesn't have one, throw ComponentNotFoundException. Otherwise returns the first component of that type.
Moves a component between this and "destination". If destination or the component are null, throw a ComponentNotFoundException. Otherwise add the component to the destination and remove it from "this".
Checks if "this" contains a component of type "TComponent". If it does, return true. Otherwise, return false.
Removes all components from "this".
Start afresh, calls RemoveAllComponents(), resets tag to an empty string and sets OwnerPool to null.
Allows an infinite(?) number of components as parameters and adds them all at once to "this".
Adds an IEnumerable of components to an Entity all at once. Calls AddComponents(params IComponent[] components) anyway.
Moves this Entity to another EntityPool (if it isn't null).
Creates a "carbon copy" of this Entity with the tag of "newTag".
Allows you to use a "+=" to add a component to "this". For example:
myEntity += new TransformComponent();