Package nz.ac.massey.javaecs
Class ECSSystem
- java.lang.Object
-
- nz.ac.massey.javaecs.ECSSystem
-
public abstract class ECSSystem extends Object
Abstract class that all systems should inherit fromDefines four required components:
- The list of entities that have all the components required for this system
- The BitSet of component registrations required for this system
- The init() function, where logic that needs to be run once is performed
- The update(dt) function, where logic that needs to be run regularly is performed. dt is the delta time in millseconds
Additional functions can be implemented as required.
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<Entity>
entities
protected BitSet
registrationSet
-
Constructor Summary
Constructors Constructor Description ECSSystem()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BitSet
getRegistrationSet()
abstract void
init()
Functionality that should be run only once.abstract void
update(double dt)
Functionality that is expected to be called regularly Intended as a template only; may be superficially implemented.
-
-
-
Method Detail
-
getRegistrationSet
public BitSet getRegistrationSet()
-
init
public abstract void init() throws Exception
Functionality that should be run only once. Implement additional parameterised init() functions as required.This is distinct from the constructor as this may be run as required any time between the construction and update(dt). It is not intended to set the actual bits of registrationSet in this function; that should be performed in the constructor.
- Throws:
Exception
- can return exceptions to the main program if an issue occurred.
-
update
public abstract void update(double dt)
Functionality that is expected to be called regularly Intended as a template only; may be superficially implemented. Implement additional parameterised update() functions as required.- Parameters:
dt
- delta-time; the change in time in milliseconds since this function was last run
-
-