CustomerSpawnController - UQcsse3200/2024-studio-3 GitHub Wiki

Customers created by Team 8

Description

The Customer Spawn Controller is made to be able to seamlessly spawn the correct customers with the correct configs. The controller uses listeners which are triggered by calls in the level system class. At a high level the spawn controller has listeners for each customer that can be called to be spawned. On that trigger the controller calls an appropriate method to spawn the respective customer. This customer is then created in NPCFactory using the configurations defined for that customer in NPCConfigs.java and NPCConfigs.Json.

Customer.JSON

Each customer will contain information rooted from a Customer.JSON file, within core/assets/images. Each customer contains several characteristics such as patience/wait time, food preferences (i.e. what the player will need to cook up to satisfy them), and a reputation meter. An example of one such customer file is seen below

"Hank": { "name": "Hank", "type": Gorilla "countDown": 20, "patience": 100, "preference": 0, "reputation": 100, "texture": "images/animal_images/gorilla.atlas" },

  • name: customers will have unique names for players to have easy identification
  • type: type reflects what animal the character is, which influences its food preferences and texture
  • countDown: timers to reflect how long each customer will stay that will be unique to each animal type. this is based on each customers patience level ie. countDown is the countdown of the patience level to 0
  • patience: timers to reflect each customers patience levels that will be unique to each animal type (this will be impacted if the player does not keep up with the order and/or if the player makes a moral decision)
  • preference: specific food preferences for each customer which will influence their orders
  • reputation: unseen reputation meter that tracks customer satisfaction and influences their behaviour in future interactions with the player (this will be impacted if the player does not keep up with the order and/or if the player makes a moral decision)
  • texture: placeholder images will be used to represent the design of each customer, allowing for future updates with actual character art and animation

Usage

PersonalCustomerEnums holds enum values for all of the customers. This ensures correct usage of the trigger. public enum PersonalCustomerEnums{ HANK, LEWIS, SILVER, JOHN, MOONKI, BASIC_CHICKEN, BASIC_SHEEP }

Within a file, spawning a customer can be done through ForestGameArea.getSpawnController.getEvents.trigger(PersonalCustomerEnums..name() where is the enum of the customer you are intending on spawning

⚠️ **GitHub.com Fallback** ⚠️