NovaStar Day One
As expected, we are off to an awesome start! With all our initial tasks delegated, everyone got working pretty quickly. We have Ryan working on the Player movement, Mar and Kurt on the weapons, Chris on the enemies, Christian on the Mid Level Boss, and myself on the Final Boss. So far everything people have put together looks awesome. Ryan’s player movement with the lerp function looks phenomenal. Mar and Kurt’s weapons are looking really cool. Christians Mid Level Boss has some awesome attacks built-in already. And for my Boss, I didn’t initially like what I had, but after scrapping my original code and taking the boss to the animator, I am extremely happy with the direction it's heading.
To start the day, I originally took a similar approach to my Final Boss in the SpaceShooter. I had hardcoded all the movements and phases. It worked and got the job done. MVP — minimum viable product. Yeah, yeah, I know. Well, anyway I was not happy with the way it looked, as it looked very clunky and unnatural. So instead of following the rules of MVP, I decided to scrap a lot of my code and go through a little self-taught animator workshop. After many hours of toying around, and playing with the animator, I am a lot happier with the outcome of the Final Boss Movement and Phases. The movements are a lot more fluid and have some life to them as opposed to a giant flying ship with very static movement.
One problem I did run into with the Boss after using animations, was my Boss no longer wanted to move during Phase 1. After a lot of trial and error and even rescripting my movement code 2 or 3 times, I had a feeling it had something to do with the Animator. So after setting up some checks to see where the problem might be, a ton of googling, and a lot of playing around with the animator in the inspector, I was correct. The root of my problem was the apply root motion feature. I either needed the animator to be disabled or the apply root motion feature to be enabled during my Phase 1, otherwise, my Boss stays still. Great. I know nothing about root motion and hardly know a thing about the animator.
My first step was to figure out how to actually enable and disable the feature. I actually came across a couple of different methods that all worked. The first method, is _anim.applyRootMotion = true. And the second is to disable the animator all together, _anim.enabled = false. Either one of these methods, allowed my player to gain access to the movement script again.
Now that I know how to disable and enable the animator/applyRootMotion, I needed to figure out where I needed to do this. To save time, I will get right to where I ended up activating and deactivating. I enabled my animator when Phase 2 starts. I disabled the animator whenever my Phase 2 ended. The second part was a little trickier, as I am still very new to animations. I realized I needed a proper way to alert the script when Phase 2 was completely finished, otherwise, the animator would shut off too soon, or the root motion would be applied too soon, and my Boss would be flying off into neverland. To do this, I set an if statement at the end of Phase 2. In the picture above, the very last if statement shows the process of doing this. I had to tag the default state as “0” in the animator. Now, once the BeamRoutine finished and transitioned back into default the game would know when to set back to Phase 1 and turn off the animator or apply root motion.
Once I get the base features of my Boss done, I would like to go back and lerp a lot of the movement. I think this would provide a much more polished effect and also I think should fix the teleporting to the middle of the y-axis before the charge.