Class movementState

java.lang.Object
com.jme3.app.state.BaseAppState
name.moore.kevin.ze.game.states.movementState
All Implemented Interfaces:
com.jme3.app.state.AppState, iZodiacState

public class movementState extends com.jme3.app.state.BaseAppState implements iZodiacState
This JMonkeyEngine application state handles the movement of the game pieces ie ships.
Author:
Kevin Moore <dev@kevin.moore.name>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private com.jme3.asset.AssetManager
     
    (package private) com.google.common.cache.LoadingCache<com.simsilica.es.EntityId,​Double>
    Cache some of the movement calculations that don't need to be repeated.
    (package private) com.google.common.cache.LoadingCache<com.simsilica.es.EntityId,​org.jscience.physics.amount.Amount<javax.measure.quantity.Mass>>
    Cache mass calculations.
    private com.simsilica.es.EntitySet
    All Entities with an distribution component.
    private com.jme3.input.InputManager
     
    private static org.slf4j.Logger
     
    private com.simsilica.es.EntitySet
    Entities that are actively moving ie have a destination.
    private int
     
    private com.jme3.scene.Node
     
    private com.jme3.app.state.AppStateManager
     
    private com.jme3.renderer.ViewPort
     
    private iZodiacApp
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    arrived​(com.simsilica.es.EntityId vehicle)
     
    protected void
    cleanup​(com.jme3.app.Application app)
     
    private void
    depart​(com.simsilica.es.EntityId vehicle, com.simsilica.es.EntityId dest)
    Leave orbit and set destination to an entity.
    void
    gameEvent​(gameEvent event)
    Listen on the eventbus for movement events and enact the appropriate changes to the involved entities.
    void
    initialize​(com.jme3.app.Application a)
    Called once when attached, copies the JME application for local use, loads XML specifications and a default game.
    private void
    move​(com.simsilica.es.EntityId eid)
    Move the entity, the distance covered depends on factors such as the engine, damage and if we are moving tactically or strategically (FTL)
    protected void
     
    protected void
     
    void
    Output a detailed report to LOGGER.trace appropriate to this state - typically of the contents of the entity repository.
    void
    trace​(com.simsilica.es.EntityId primary)
    Provide a detailed report to LOGGER.trace on the specific entity.
    void
    update​(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, stateDetached

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface name.moore.kevin.ze.game.states.iZodiacState

    windowEvent
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • zapp

      private iZodiacApp 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
    • movingSet

      private com.simsilica.es.EntitySet movingSet
      Entities that are actively moving ie have a destination.
    • distributionSet

      private com.simsilica.es.EntitySet distributionSet
      All Entities with an distribution component.
    • cacheEPM

      com.google.common.cache.LoadingCache<com.simsilica.es.EntityId,​Double> cacheEPM
      Cache some of the movement calculations that don't need to be repeated.
    • cacheMass

      com.google.common.cache.LoadingCache<com.simsilica.es.EntityId,​org.jscience.physics.amount.Amount<javax.measure.quantity.Mass>> cacheMass
      Cache mass calculations.
    • renderingCounter

      private int renderingCounter
  • Constructor Details

    • movementState

      public movementState(String id)
      Parameters:
      id -
  • Method Details

    • initialize

      public void initialize(com.jme3.app.Application a)
      Called once when attached, copies the JME application for local use, loads XML specifications and a default game.
      Specified by:
      initialize in class com.jme3.app.state.BaseAppState
      Parameters:
      a - A zodiac object.
      See Also:
      zodiac
    • cleanup

      protected void cleanup(com.jme3.app.Application app)
      Specified by:
      cleanup in class com.jme3.app.state.BaseAppState
    • onEnable

      protected void onEnable()
      Specified by:
      onEnable in class com.jme3.app.state.BaseAppState
    • onDisable

      protected void onDisable()
      Specified by:
      onDisable in class com.jme3.app.state.BaseAppState
    • update

      public void update(float tpf)
      Called automatically and repeatedly while the state is enabled and attached.
      Specified by:
      update in interface com.jme3.app.state.AppState
      Overrides:
      update in class com.jme3.app.state.BaseAppState
      Parameters:
      tpf -
    • gameEvent

      public void gameEvent(gameEvent event)
      Listen on the eventbus for movement events and enact the appropriate changes to the involved entities.
      Specified by:
      gameEvent in interface iZodiacState
      Parameters:
      event -
    • depart

      private void depart(com.simsilica.es.EntityId vehicle, com.simsilica.es.EntityId dest)
      Leave orbit and set destination to an entity. This entity is now in the movingSet and will trigger getAddedEntities()
      Parameters:
      vehicle - vehicle to getEntityComponent moving eg a ship.
      dest - destination entity
    • arrived

      private void arrived(com.simsilica.es.EntityId vehicle)
      Parameters:
      vehicle - the entity entering orbit eg ship.
    • move

      private void move(com.simsilica.es.EntityId eid)
      Move the entity, the distance covered depends on factors such as the engine, damage and if we are moving tactically or strategically (FTL)

      Entities that are moving use coordinates. These are set by events such as breaking orbit.

      Parameters:
      eid -
    • trace

      public void trace()
      Output a detailed report to LOGGER.trace appropriate to this state - typically of the contents of the entity repository.
      Specified by:
      trace in interface iZodiacState
    • trace

      public void trace(com.simsilica.es.EntityId primary)
      Description copied from interface: iZodiacState
      Provide a detailed report to LOGGER.trace on the specific entity.
      Specified by:
      trace in interface iZodiacState