495 - Sprint 2
Bootleg Studios - Programmer Sprint 2
Interpolating Camera With Button Clicks
For Sprint 2, in the beginning I was finishing the touches on camera transitions to each window, along with the buttons appearing then disappearing on each transition. For ex. when you go to the order window, once you arrive at the order window the buttons will appear, then if you transition to the still, the old buttons will disappear and then the new buttons will reappear. That goes for the same with all windows and with smoothly transitioned camera. I really didn't touch the camera this sprint. just made sure the buttons were exactly how the Lead and Producer wanted them so I can go on to my next task.
Interactable Glassware, Color and Flavor Objects
For the most of this sprint I was working on pretty much the whole interactable selection with the glassware, color of liquid and flavor objects. First you choose a glassware you desire to brew, then a color of liquid and whichever glassware you choose, the glassware object will begin to fill up with liquid with the desire color you have chosen and then after you choose a flavor.
Shader Graphs
I also dabbled with Shader Graphs to get the effect of the glassware actually be filled up with liquid so the player can see the interaction he or she chooses upon choosing a color of liquid with the glassware. This gives insight on giving the player a sense of progression when choosing the glassware and color of liquid.
Adding the Camera transitions with the RV Model.
Since the modeler was able to finish the RV, my producer gave me a task to fix the camera transition to fit inside the RV, this was fairly simple because I created specific floats along the X, Y, Z for every window transition so when the time came to do the RV transitions I already knew where to go to fix those float variables.
Some problems I encountered on the way were starting off how to create a system for the interactable objects this wasn't too difficult I just had to think where to start. First I created tags and named them all in the order I needed, then I created a box collider on each object so I can click on that object. then using Input.GetMouseButtonDown(0)) with a ray cast along with a ScreenToPointRay I was able to do click on any object with the appropriate tag as long as it has a box collider. With the ShaderGraphs, i was fairly new how to use them in Unity and I followed a tutorial to help me create a liquid effect inside a bottle but the tutorial didn't show how to fill it up. it just showed how to put liquid in a bottle. To increase the liquid to give it a sense of the bottle filling up I just grabbed that ShaderGraph material inside a IEnumerator and made it go from 0 to 1 and increased the float .1 every .8 seconds. So when you choose a glassware, and color of liquid the Coroutine will start and fill up the glassware with liquid. Now the part I was the most trouble on was actually slapping the PNG flavor infront of the glassware you choose. This was by far for no reason the most difficult process. I tried so many times by just getting each glassware's position and rotation and setting the image and it would either ruin my scene or it would just not work at all. I ended up fixing the problem just by slapping 4 hidden png flavors infront of each glassware object and I'll show you how I implemented them.
Logic
In the Start() function I manually set the ShaderGraph material float to 0 to represent an empty glassware object. Then foreach image in flavorImages I set all the images to false upon start. this represents the flavor png image that you select when you brew a glassware object with a color. It will get set to true later on.
(2/2) After this the currentstate is begginig for the selection of choosing a glassware object, mason jar, doublerocksglass, shotglass, and decanter. after you choose a glassware object, then you go to choose a color, after you choose a color the IncreaseLiquid() function start's giving the effect of a glassware object begin filling with liquid on a chosen color. After this now you select a flavor that you want the liquid to be, and this will slap a png image infront of the glassware object, then everything resets and this will allow you to brew as much glassware objects the player wants!
In the GetColorFromTag() function I just used a switch method that my professor Jeff showed us a long time ago in 280 I believe, and this just gets the tag and return it with a color. The IEnumerator function handles the liquid effect, resetting the liquid effect and resetting the images that are applied to the glassware.
ResetSelection() function resets all the variables so the player is able to brew more choices, and the EnableFlavorImage() function allows the hidden flavor png image to appear and a selected glassware after choosing a flavor, and the OnMouseDown() handles the isSelecting bool that is in the update function.
Function SetButtonsActive() handles setting the buttons active and inactive durection the computer transitions, and in the ComputerTransition() function you can see it starts to hide all the buttons and then set certain elements to true so the player can move around the scene. In the IEnumerator Coroutine the canvasgroup that has the buttons it toggles the alpha on and off to give an effect so when the camera reach a new window it appears to 1 and if you leave a window it toggles it to 0. That being said the buttons dont always appear on during transitions and each specific button alpha turns on and off during a window transition so the player can navigate around the scene.
Lastly, this is my ScriptableObject LiquidEffect that are applied to each glassware.
Comments
Post a Comment