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 Summary
Modifier and TypeFieldDescriptionprivate final int
private final ArrayList<com.badlogic.ashley.core.Entity>
private final EntityFactory
private boolean
private final Hud
private int
private final Map<Integer,
Box2dLocation> private final Integer[]
private final GdxTimer
private final com.badlogic.gdx.physics.box2d.World
Fields inherited from class com.badlogic.ashley.core.EntitySystem
priority
-
Constructor Summary
ConstructorDescriptionCustomerAISystem
(Map<Integer, Box2dLocation> objectives, com.badlogic.gdx.physics.box2d.World world, EntityFactory factory, Hud hud, Integer[] reputationPoints) Instantiate the system. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
destroyCustomer
(com.badlogic.ashley.core.Entity customer) Remove the customer from theWorld
and remove their entity.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 listprivate void
makeItGoThere
(AIAgentComponent aiAgent, int locationID) Give the customer an objetive to go to.protected void
processEntity
(com.badlogic.ashley.core.Entity entity, float deltaTime) This method is called on every entity on every update call of the EntitySystem.void
update
(float deltaTime) The update method called every tick.Methods inherited from class com.badlogic.ashley.systems.IteratingSystem
addedToEngine, getEntities, getFamily, removedFromEngine
Methods inherited from class com.badlogic.ashley.core.EntitySystem
checkProcessing, getEngine, setProcessing
-
Field Details
-
objectives
-
objectiveTaken
-
world
private final com.badlogic.gdx.physics.box2d.World world -
spawnTimer
-
factory
-
numOfCustomerTotal
private int numOfCustomerTotal -
hud
-
reputationPoints
-
CUSTOMER
private final int CUSTOMER- See Also:
-
firstSpawn
private boolean firstSpawn -
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 availableworld
- Box2DWorld
for AI and disposing of customer entities.factory
-EntityFactory
for creating new customershud
-HUD
for updating orders, reputationreputationPoints
- array-wrapped integer reputation passed by-reference SeeHud
-
-
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 classcom.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 classcom.badlogic.ashley.systems.IteratingSystem
- Parameters:
entity
- The current Entity being processeddeltaTime
- The delta time between the last and current frame
-
destroyCustomer
private void destroyCustomer(com.badlogic.ashley.core.Entity customer) Remove the customer from theWorld
and remove their entity. -
makeItGoThere
Give the customer an objetive to go to.- Parameters:
locationID
- and id fromCustomerAISystem.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
-