495 Sprint 3
Bootleg Studios - Programmer Sprint 3
Rain Effect
I was tasked to give a rain effect to give an effect for the environment throughout the day so the game can have different weather patterns.
Customers & Orders
I was also tasked to create customers, have them move to the order window, give orders to the player, when an order gets completed the customer leaves and a new one comes and gives a new order to the player. all csutomers orders also pertain to each of the 4 glassware, 4 colors, and 4 flavors making it random for the player.
Finished Drinks to Inventory
I also got tasked to finish all orders adding up to 64 individual orders to go into your inventory when you're done. When you finish a specific order of glassware, color, and flavor it goes right into your inventory.
Buying Glassware
I was also given a task that players need to save up their money to buy glassware before creating orders. After the customer buys a specific glassware that specific glassware also gets removed from their inventory
Problem I encountered on the way
Some problems I encountered on the way were how to add each individual order into the inventory. As I did not make the inventory script I had to comply with the script I had. As it was very very confusing to me at first since there was no comments I had to sit down and understand what was happening and I did get confused at times so I went to Weston and he helped me understand what was going on in his inventory script and that helped a lot. I finally was able to reference his inventory script into my script so when the player got done making his order it would go into the inventory. Another problem I encountered on was creating the orders for the customers. I also had to reference westons ordermaker script although it was not all the way finished luckily I was able to finish the script and reference it to the customer so it was not too difficult. I also had some trouble matching up each glassware, color and flavor to the customers specific order, inside my script I had to convert each flavor, color, and glassware to an index so it matches the OrderMaker script integers which was difficult yet super fun and satisfying.
Logic
For the rain effect it was super easy it's just a particle effect that I manipulated to give a rain effect, although if you click on emission > rate over time and set it to a huge number it will lag the whole game lol.
1/2 this script is attached to the customer when the customer gets instantiated right at the start of the game (which is in a different script called CustomerSpawner) the customer will find the GameManager that has the "OrderMaker" script that weston and I made. if ordermaker is not equal to null then go inside the ordermaker script and call the OrderUp() function which is inside of RequestOrder() so the customer can request orders. Then when the order is complete the customer leaves.
2/2 With the CustomerSpawner script, the script spawns a customer with the prefab I made and sets the customer at the "spawnpoint" position which is just an empty gameobject that you can put anywhere on the map. Then the customer will move towards the "windowpoint" position which is also a empty gameobject thats right infront of the orderwindow, so it looks like a customer is coming up to the window for an order. Right at the start of the game the customer requests an order and maybe for the next sprint I can talk to my producer and lead to maybe have the RequestOrder function get called when the customer reaches the orderwindow. then for the CustomerMovement script it just talks to the CustomerSpawner script so it knows where to go via navmeshsystem.
Now inside of the OrderMaker script I have 3 integers that are called flavor, color, and glasses. For these integers I use a Random.Range so all 4 flavors, colors, and glassware are randomized for a a customer order, and inside of the "OrderSlot" script that I reference at the top it creates a debug log inside the console that when a customer get's spawned you can see what the order is. for next sprint grant wants a specific way the order gets brought up so that is why I have a debug log in the menu for now.
For buying and removing glassware, Weston created the getButtonItem() function inside his inventory script and I created the removeItem() function because as of right now you can only buy glassware and if you use the glassware, the glassware would need to be removed from the inventory.
Then In my ClickableItem script the private bool HasGlasswareInInventory bool checks to see if you have a glasstype that is equal to shot,mason,decanter, or double with no flavor and color if it is true you can go ahead and click on a glassware pertaining to that glasstype. so if you have a mason with no color or flavor then you can click on the masonjar and start brewing an order. For GetSelecterGlasswareFromInventory() function that checks if you have a glassware type and returns that type and removes it from RemoveSelectedGlasswaoreFromInventory() function down below.
Inside this long Update() method you first go into the state to choose a glassware but first you need a piece of glassware to move along. You need to have either a mason,decanter,shotglass or doublerockglass to go further down the update method. if you do then choose the corresponding glasstype you have in your inventory, So if you have a mason jar then choose the mason jar gameobject and that gameobject has the tag "masonjar" on it. Once you choose the mason jar, that old empty masonjar with no flavor and color gets removed from your inventory also that "currGlass" string get set to that specific InventorySlot.Glass. Then you move onto the color and choose the correct color the customer wants his item to be ordered with, and the provided colors are clear, red, green or brown. Once you choose a color that curColor gets set to that specific InventoryShot.Color, and once you choose a color the liquid animation fill up the glassware object. Lastly for that last selectionstate is the flavor, now you choose a flavor. You can choose up to 4 flavors that are cherry, honey, lightning, and apple. Once you choose a color a png gets slapped infront of the gameobject you are making and dissapears when it completes "brewing". After all the SelectionStates, finally each Glasstype, Flavor, and Color you choose gets set to an index and then added into your inventory with the inventory.GetItem(variables) function and the functionCheckOrderCompletion() checks if you created the correct order, if not you get a debug log saying correct, if wrong you get a debug saying wrong. I believe that logic is explained up above.
Comments
Post a Comment