public class Node extends Object implements EngineHolder<CoreEngine>, Updatable, Renderable
Entity (entites).| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Node> |
children
Maps children's names to children.
|
protected CoreEngine |
engine
The active CoreEngine
|
protected ArrayList<Entity> |
entities
List of Entities, attached to this Node
|
protected String |
name
Node's name
|
protected Node |
parent
Parent Node.
|
protected SingleEntityRetriever |
singleEntityRetriever
Used in
getEntity(Class) |
protected Transform |
transform
Transform of this Node and all the attached
Entities
|
| Constructor and Description |
|---|
Node()
Creates and untitled Node.
|
Node(String name)
Create a new Node.
|
| Modifier and Type | Method and Description |
|---|---|
Node |
add(Entity entity)
Add an Entity to this Node.
|
Node |
add(Node node)
Adds Node as a children.
|
Node |
add(Node node,
boolean forceName)
Adds Node as a children.
|
Map<String,Node> |
getChildren()
Returns List of child-Nodes
|
CoreEngine |
getEngine()
Retrieves the stored engine
CoreEngine
|
List<Entity> |
getEntities()
Returns List of Entities
|
<T extends Entity> |
getEntity(Class<T> type)
Convenience method.
|
String |
getName()
The name of this Node
|
Node |
getParent() |
Transform |
getTransform()
Returns the Transform associated with this Node
and all it's Child-Entities.
|
boolean |
remove(Entity entity)
Remove Entity from this Node.
|
boolean |
remove(Node node)
Removes child Node from this Node.
|
boolean |
remove(String nodeName)
Remove Node by it's name
|
void |
removed()
When this Node has been removed from it's parent, this method
will get called and notifies all children and child-entites.
|
void |
render(RenderEngine renderEngine)
Trigger an render.
|
void |
setChildren(Map<String,Node> children)
Replaces children.
|
void |
setEngine(CoreEngine engine)
Inject the engine
CoreEngine.
|
void |
setEntities(ArrayList<Entity> entities)
Replaces Entities.
|
void |
setName(String name)
Set the name of this Node
|
void |
setParent(Node parent) |
void |
setTransform(Transform transform)
Replaces Transform
|
String |
toString() |
void |
update(float delta)
Trigger an update.
|
protected Node parent
protected Transform transform
protected CoreEngine engine
protected String name
protected SingleEntityRetriever singleEntityRetriever
getEntity(Class)public Node(String name)
name - The name of the nodepublic Node()
NULL until its
getting added as a child to another node.
(Then name will be "PARENT-NODE >> Untitled Node X" where X is
the number of already existing subnodes.public void update(float delta)
public void render(RenderEngine renderEngine)
render in interface RenderablerenderEngine - The active RenderEnginepublic Node add(Node node)
node - New childpublic Node add(Node node, boolean forceName)
node - New childforceName - Whether to prevent auto-generation of namespublic Node add(Entity entity)
Transform.entity - New Entity to addpublic boolean remove(Node node)
node - Node to removepublic boolean remove(String nodeName)
nodeName - Node's namepublic boolean remove(Entity entity)
QuickEntity handles this problems
and sets parent to null on removal.
This will call Entity.removed() on the given Entityentity - The Entity to removepublic void removed()
public <T extends Entity> T getEntity(Class<T> type)
SingleEntityRetriever
and scans this node.
Returns the first Entity if
there were multiple of the given type!
NOTE: This wall ALWAYS scan this whole node.T - type of Entitytype - Class of type of Entitypublic void setChildren(Map<String,Node> children)
children - New childrenpublic void setEntities(ArrayList<Entity> entities)
entities - New Entitiespublic Transform getTransform()
public void setTransform(Transform transform)
transform - New Transformpublic CoreEngine getEngine()
getEngine in interface EngineHolder<CoreEngine>public void setEngine(CoreEngine engine)
setEngine in interface EngineHolder<CoreEngine>engine - The engine to storepublic String getName()
public void setName(String name)
name - New namepublic Node getParent()
public void setParent(Node parent)
Copyright © 2014. All rights reserved.