Class Component

java.lang.Object
com.mygdx.game.Components.Component
Direct Known Subclasses:
AINavigation, Pirate, PlayerController, Renderable, RigidBody, Text, 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()  
  • Method Summary

    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 rendering
    void setParent​(Entity e)  
    void setRequirements​(ComponentType... reqs)
    Sets the required components
    void start()
    Called once after awake but prior to the update loop.
    void update()
    Called once per frame

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • type

      protected ComponentType type
    • parent

      protected Entity parent
    • requirements

      protected java.util.ArrayList<ComponentType> requirements
    • reqsMet

      protected boolean reqsMet
  • Constructor Details

    • Component

      protected Component()
  • Method Details

    • setParent

      public void setParent​(Entity e)
    • getParent

      public Entity getParent()
    • setRequirements

      public final void setRequirements​(ComponentType... reqs)
      Sets the required components
      Parameters:
      reqs - take a guess
    • getType

      public final ComponentType getType()
    • 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