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
FieldsModifier and TypeFieldDescriptionprivate final intprivate final ArrayList<com.badlogic.ashley.core.Entity>private final EntityFactoryprivate booleanprivate final Hudprivate intprivate final Map<Integer,Box2dLocation> private final Integer[]private final GdxTimerprivate final com.badlogic.gdx.physics.box2d.WorldFields inherited from class com.badlogic.ashley.core.EntitySystem
priority -
Constructor Summary
ConstructorsConstructorDescriptionCustomerAISystem(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 voiddestroyCustomer(com.badlogic.ashley.core.Entity customer) Remove the customer from theWorldand remove their entity.private voidfulfillOrder(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 voidmakeItGoThere(AIAgentComponent aiAgent, int locationID) Give the customer an objetive to go to.protected voidprocessEntity(com.badlogic.ashley.core.Entity entity, float deltaTime) This method is called on every entity on every update call of the EntitySystem.voidupdate(float deltaTime) The update method called every tick.Methods inherited from class com.badlogic.ashley.systems.IteratingSystem
addedToEngine, getEntities, getFamily, removedFromEngineMethods 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- Box2DWorldfor AI and disposing of customer entities.factory-EntityFactoryfor creating new customershud-HUDfor 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.EntitySystemThe update method called every tick.- Overrides:
updatein 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.IteratingSystemThis method is called on every entity on every update call of the EntitySystem. Override this to implement your system's specific processing.- Specified by:
processEntityin 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 theWorldand 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
-