Sarah Reen - Week 8 Devlog


Programming - 6 hours

I continued my work on implementing the Interaction System which will be vital in implementing the various Gizmos and "Gadgets." Gizmos refer to the 4 main objects the two players will be interacting with (Lever, Button, Crank, Slider), and Gadgets refer to the objects that are affected by those Gizmos (Door, Laser, Air Turbine, etc.) When a player interacts with a Gizmo, it needs to do two main things: 

  1. Retrieve Data about the Specific Gizmo the player has interacted with and update the value of it
  2. Retrieve Data about the Specific Gadget the Gizmo will be affecting and update it with the given value from the Gizmo

All Gizmo Objects Inherit form a base Parent known as InteractableBase. This class sets up the needed functions for what is required in Step 1. It sets up an interaction event and then updates its value based on that specific interaction event. It then calls another function that Updates the Specific Gadget. 

Section of the InteractableBase Script

Section of the InteractableBase Script

However, we will have several different types of gizmos that all have unique attributes and characteristics. It would be better to place that logic in its separate script that inherits from InteractableBase. This keeps our code clean and organized, without running the risk of certain objects having access to things they shouldn't have. For example, in the Lever Script, it can update its value to either 0 or 1; the only two values that it can have are reflected by the Up or Down state. But in comparison, the Crank Script updates its value between a range of 0 to 1 based on the position of its child object in a 360-degree rotation. 

Part of the Lever Script

Part of the Lever Script

We then need to retrieve data about the specific Gadget that we want to update given the value of the Gizmo. This is done similarly to how we retrieve the Gizmo: with scriptable Object. When interacting with an object, the InteractionBase searches for the Gizmo Data of the given object. It then populates itself with that data to perform certain functions successfully. The InteractionBase will also then have to search for the relevant Gadget Data based on several properties such as which wire the gizmo is attached to, and what Gadget is also attached to that wire. This part of the script is still a work in progress. 

Frame before Interaction Takes place

Frame before Interaction takes place
Frame after Interaction has occurred
Frame after interaction has occurred; make note of the comments in the console
Currently, the lever Gizmo and Door Gadget are working as intended, but more work needs to be done with the Crank. Since the Button and Slider are simply slightly different versions of the Lever and Crank, they will not take nearly as long to develop once the previous two are finished. I'm hoping to have all of this done before the 50% Sprint. 

Get Spit It Out!

Leave a comment

Log in with itch.io to leave a comment.