Joining Capture Point Stone went a lot smoother than I thought it would. I was able to pick up the code pretty easily and integrate my starting features. None of my features were too complicated, and one of them I was able to use a script I wrote for one, to complete another. I first read through the onboarding doc, design doc, and tech docks to get a feel for how things are done on this team. I then looked through the code to familiarize myself with the codebase.
My tasks included adding an interaction to a life preserver so that when selected, it would squish, and when selected + joystick-up, it would flip it over board. To do this, I created an animation for flipping it overboard, (squish animation was already made by someone else), I then wrote a "DirectionalInteraction" script that includes 5 settings for the designers: onAnimTriggerSelect, onAnimTriggerUp, onAnimTriggerDown, onAnimTriggerLeft, onAnimTriggerRight. The designer writes a string in each relevant slot, and when the corresponding interaction is performed by the player (onAnimTriggerSelect = just select, onAnimTriggerRight = select + joystick-right), it sends the corresponding designer-set trigger to the animator.
My next task was to make objects spawn when the cloud is selected. For this I wrote a "SpawnObjectInteraction" script, that uses an object pool to activate/deactivate objects as needed. I wrote it so the designers just place in the scene, all the possible objects (I have 6 placeholder random shapes). They then deactivate them. Then when the object is selected, it picks a random deactivated object and sets it to the clouds position and resets its velocity, then activates it. Then once it falls off screen, it deactivates the spawned object so it can be reused. The objects being spawned, the spawn position, and the height at which they deactivate, and amount of interactions before it starts spawning objects, are all editable in the inspector for designers.
Lastly the only thing I had to do was add an interaction for knocking over the trash can. Luckily that could use my DirectionalInteraction script I wrote for the life preserver, so that task took me all of 30 seconds. Hardest part was making a basic placeholder falling over animation for the trash can.
I like writing my code to be reusable, without going overboard obviously. It can be easy to make your code too generic or reusable, when it is for something so specific, you will never reuse it, but considering how often, in this game the player has to hit select+direction, which triggers an animation, I figure this directional interaction script will be used a lot. It will save a lot of time in having to write a whole new script to just send a trigger to an animator.
The only thing so far that made me a bit nervous was less the code base and more just good source control practice. They have a different way of handling the repo than I am used to and I was worried I would do something wrong and mess up the repo. Nothing that could cause irreversible damage, just something that would cause momentary embarrassment for myself. It caused me to wait a bit longer to commit my changes. But after talking to the lead programmer, I was able to get it and have commited all my changes and am ready to dive into this game.
Commentaires