Package name.moore.kevin.ze.game.states
Class combatState
java.lang.Object
com.jme3.app.state.BaseAppState
name.moore.kevin.ze.game.states.combatState
- All Implemented Interfaces:
com.jme3.app.state.AppState,iZodiacState
This JMonkeyEngine application state handles confrontations between (for
instance) ships.
This state is only going to be active on the tactical screen where entities
come into contact. The entities are added through an ENGAGE gameEvent.
- Author:
- Kevin Moore
<dev@kevin.moore.name>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.jme3.asset.AssetManagerprivate Map<com.simsilica.es.EntityId,com.simsilica.es.EntityId>Entities that are actively firing (or trying to) as part of combat.private com.jme3.input.InputManagerprivate static org.slf4j.Loggerprivate intprivate com.jme3.scene.Nodeprivate com.jme3.app.state.AppStateManagerprivate com.jme3.renderer.ViewPortprivate iZodiacApp -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcleanup(com.jme3.app.Application app)private voiddisengage(com.simsilica.es.EntityId primary)private voidengage(com.simsilica.es.EntityId primary, com.simsilica.es.EntityId secondary)Primary entity adds secondary to target listprivate voidfire(com.simsilica.es.EntityId attacker)voidListen on the eventbus for events and enact the appropriate changes to the involved entities.voidinitialize(com.jme3.app.Application a)Called once when attached, copies the JME application for local use.protected voidprotected voidonEnable()voidtrace()Output a detailed report to LOGGER.trace appropriate to this state - typically of the contents of the entity repository.voidtrace(com.simsilica.es.EntityId primary)Provide a detailed report to LOGGER.trace on the specific entity.voidupdate(float tpf)Called automatically and repeatedly while the state is enabled and attached.Methods inherited from class com.jme3.app.state.BaseAppState
cleanup, getApplication, getId, getState, getState, getState, getState, getStateManager, initialize, isEnabled, isInitialized, postRender, render, setEnabled, setId, stateAttached, stateDetachedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface name.moore.kevin.ze.game.states.iZodiacState
windowEvent
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
zapp
-
rootNode
private com.jme3.scene.Node rootNode -
assetManager
private com.jme3.asset.AssetManager assetManager -
stateManager
private com.jme3.app.state.AppStateManager stateManager -
inputManager
private com.jme3.input.InputManager inputManager -
viewPort
private com.jme3.renderer.ViewPort viewPort -
combatSet
Entities that are actively firing (or trying to) as part of combat. Two ships in combat will create two entries with each having the other ship as a target. There is no constraint that the entities are ships, though most likely - but it must have a weapon! a Map means there is only one designated target for an attacker. -
renderingCounter
private int renderingCounter
-
-
Constructor Details
-
combatState
- Parameters:
id-
-
-
Method Details
-
initialize
public void initialize(com.jme3.app.Application a)Called once when attached, copies the JME application for local use.- Specified by:
initializein classcom.jme3.app.state.BaseAppState- Parameters:
a- A zodiac object.- See Also:
zodiac
-
cleanup
protected void cleanup(com.jme3.app.Application app)- Specified by:
cleanupin classcom.jme3.app.state.BaseAppState
-
onEnable
protected void onEnable()- Specified by:
onEnablein classcom.jme3.app.state.BaseAppState
-
onDisable
protected void onDisable()- Specified by:
onDisablein classcom.jme3.app.state.BaseAppState
-
update
public void update(float tpf)Called automatically and repeatedly while the state is enabled and attached.- Specified by:
updatein interfacecom.jme3.app.state.AppState- Overrides:
updatein classcom.jme3.app.state.BaseAppState- Parameters:
tpf-
-
gameEvent
Listen on the eventbus for events and enact the appropriate changes to the involved entities.- Specified by:
gameEventin interfaceiZodiacState- Parameters:
event-
-
engage
private void engage(com.simsilica.es.EntityId primary, com.simsilica.es.EntityId secondary)Primary entity adds secondary to target list- Parameters:
primary-secondary-
-
disengage
private void disengage(com.simsilica.es.EntityId primary) -
fire
private void fire(com.simsilica.es.EntityId attacker) -
trace
public void trace()Description copied from interface:iZodiacStateOutput a detailed report to LOGGER.trace appropriate to this state - typically of the contents of the entity repository.- Specified by:
tracein interfaceiZodiacState
-
trace
public void trace(com.simsilica.es.EntityId primary)Description copied from interface:iZodiacStateProvide a detailed report to LOGGER.trace on the specific entity.- Specified by:
tracein interfaceiZodiacState
-