T
- The enum containing all types.S
- The setup type used.O
- The object type used.public abstract class FactoryObjectGame<T extends Enum<T> & ObjectType,S extends SetupGame,O extends ObjectGame> extends FactoryGame<T,S>
SetupGame
considering an input enumeration. This way it is possible to create new
instances of ObjectGame
related to their ObjectType
by sharing the same data.
Sample implementation:
public class FactoryObject extends FactoryObjectGame<EntityType, SetupGame, ObjectGame> { public FactoryObject() { super(EntityType.class, "objects"); load(); } @Override protected SetupGame createSetup(EntityType type, Media config) { return new SetupGame(config); } }
Constructor and Description |
---|
FactoryObjectGame(Class<T> enumType,
String folder)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<E extends O> |
create(T type)
Create an object from its type using a generic way.
|
protected S |
createSetup(T type)
Get setup instance from the type.
|
protected abstract S |
createSetup(T type,
Media config)
Create a setup from its media.
|
addSetup, getSetup, getTypes, load
protected abstract S createSetup(T type, Media config)
type
- The object type.config
- The setup media config file.public <E extends O> E create(T type)
ObjectGame.ObjectGame(SetupGame)
.E
- The object type used.type
- The object type.protected S createSetup(T type)
FactoryGame
createSetup
in class FactoryGame<T extends Enum<T> & ObjectType,S extends SetupGame>
type
- The enum type.Copyright © 2014 Byron 3D Games Studio. All rights reserved.