Class CustomerAISystem

java.lang.Object
com.badlogic.ashley.core.EntitySystem
com.badlogic.ashley.systems.IteratingSystem
com.devcharles.piazzapanic.componentsystems.CustomerAISystem

public class CustomerAISystem extends com.badlogic.ashley.systems.IteratingSystem
Controls the AI Customers, creates orders.
  • Field Details

    • objectives

      private final Map<Integer,Box2dLocation> objectives
    • objectiveTaken

      private final Map<Integer,Boolean> objectiveTaken
    • world

      private final com.badlogic.gdx.physics.box2d.World world
    • spawnTimer

      private final GdxTimer spawnTimer
    • factory

      private final EntityFactory factory
    • numOfCustomerTotal

      private int numOfCustomerTotal
    • hud

      private final Hud hud
    • reputationPoints

      private final Integer[] reputationPoints
    • CUSTOMER

      private final int CUSTOMER
      See Also:
    • firstSpawn

      private boolean firstSpawn
    • customers

      private final ArrayList<com.badlogic.ashley.core.Entity> customers
  • Constructor Details

    • CustomerAISystem

      public CustomerAISystem(Map<Integer,Box2dLocation> objectives, com.badlogic.gdx.physics.box2d.World world, EntityFactory factory, Hud hud, Integer[] reputationPoints)
      Instantiate the system.
      Parameters:
      objectives - Map of objectives available
      world - Box2D World for AI and disposing of customer entities.
      factory - EntityFactory for creating new customers
      hud - HUD for updating orders, reputation
      reputationPoints - array-wrapped integer reputation passed by-reference See Hud
  • Method Details

    • update

      public void update(float deltaTime)
      Description copied from class: com.badlogic.ashley.core.EntitySystem
      The update method called every tick.
      Overrides:
      update in class com.badlogic.ashley.systems.IteratingSystem
      Parameters:
      deltaTime - The time passed since last frame in seconds.
    • processEntity

      protected void processEntity(com.badlogic.ashley.core.Entity entity, float deltaTime)
      Description copied from class: com.badlogic.ashley.systems.IteratingSystem
      This method is called on every entity on every update call of the EntitySystem. Override this to implement your system's specific processing.
      Specified by:
      processEntity in class com.badlogic.ashley.systems.IteratingSystem
      Parameters:
      entity - The current Entity being processed
      deltaTime - The delta time between the last and current frame
    • destroyCustomer

      private void destroyCustomer(com.badlogic.ashley.core.Entity customer)
      Remove the customer from the World and remove their entity.
    • makeItGoThere

      private void makeItGoThere(AIAgentComponent aiAgent, int locationID)
      Give the customer an objetive to go to.
      Parameters:
      locationID - and id from CustomerAISystem.objectives
    • fulfillOrder

      private void fulfillOrder(com.badlogic.ashley.core.Entity entity, CustomerComponent customer, com.badlogic.ashley.core.Entity foodEntity)
      Give customer food, send them away and remove the order from the list