This week was the proper implementation of the Supercharging System. As a refresher, this system is meant to apply a boost to a crystal for the rest of a run. My solo work consisted of creating a system for being able to click a crystal to supercharge once a discard criteria has been met. After the player discards x number of crystals, he is automatically forced to select a crystal to supercharge. The problem to overcome was how to implement this in relation to our Draggable queue and other scripts. My solution was to encapsulate the code that handles the queue into a method. If the discarded crystal is the last Draggable in our queue, I will delay the execution of this code until after the supercharge process is complete, thus delaying the resuming of gameplay.
After this came a proper implementation of exactly what we wished supercharging to do. My original concept simply applied a buff of 100% to the crystal. This had its obvious drawbacks, however. If you charged a crystal before it was leveled at all, you would be getting a much worse upgrade than if you waited until the end of the game to supercharge. Our decision was to apply a flat 100% bonus at all times. To do this, our buff system and every ability script needed tweaked. We have crystal frameworks that have a list of variables whose information is transferred to a Crystal script whenever a crystal is placed. When instantiating the appropriate crystal ability script, the information from the Crystal script is used, not the framework. The values in Crystal are updated when buffs are applied. This presents an issue when trying to move to a buff system where buffs are applied determinant on a base value. I worked with two of our other programmers to rework this system.
Our solution consisted of adding a variable to our frameworks. This would be the value that is changed by our buff methods. Then, whenever an ability script receives values from Crystal, it calculates the total value based on the base value + the buffed value. Whenever a crystal is buffed, the total is multiplied by our supercharge value.
The system is not fully implemented. I need to take the time to ensure the player does not get given the option to supercharge when there are no viable crystals to supercharge. This will involve reworks to the current queue solution and the preplaced crystal solution. The latter is a popup that asks whether the crystals should be swapped or supercharged.
I did not get to work on my other task of implementing a sprite system for our crystals to use multiple sprites per object. This will be my focus late next week.