Package com.mygdx.game.Components
Class Component
- java.lang.Object
-
- com.mygdx.game.Components.Component
-
- Direct Known Subclasses:
AINavigation
,ObstacleControl
,Pirate
,PlayerController
,PowerUpAssigned
,Renderable
,RigidBody
,TileMap
,Transform
public abstract class Component extends java.lang.Object
Base class for the Components
-
-
Field Summary
Fields Modifier and Type Field Description protected Entity
parent
protected boolean
reqsMet
protected java.util.ArrayList<ComponentType>
requirements
protected ComponentType
type
-
Constructor Summary
Constructors Modifier Constructor Description protected
Component()
sets up the Component
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
awake()
Called once before start prior to the update loop.void
cleanUp()
Called once after the update loop has finished.Entity
getParent()
ComponentType
getType()
void
render()
Called once per frame used exclusively for renderingvoid
setParent(Entity e)
void
setRequirements(ComponentType... reqs)
Sets the required componentsvoid
start()
Called once after awake but prior to the update loop.void
update()
Called once per frame
-
-
-
Field Detail
-
type
protected ComponentType type
-
parent
protected Entity parent
-
requirements
protected java.util.ArrayList<ComponentType> requirements
-
reqsMet
protected boolean reqsMet
-
-
Method Detail
-
setParent
public void setParent(Entity e)
- Parameters:
e
- the Entity to set the parent of this component to
-
getParent
public Entity getParent()
- Returns:
- the parent of this component
-
setRequirements
public final void setRequirements(ComponentType... reqs)
Sets the required components- Parameters:
reqs
- take a guess
-
getType
public final ComponentType getType()
- Returns:
- the type of the component
-
awake
public void awake()
Called once before start prior to the update loop.
-
start
public void start()
Called once after awake but prior to the update loop.
-
cleanUp
public void cleanUp()
Called once after the update loop has finished.
-
update
public void update()
Called once per frame
-
render
public void render()
Called once per frame used exclusively for rendering
-
-