I'm still having motivation issues, but the best way to deal with them is to just push through and keep going. It is important to recognize when pushing through does more harm than good though. Pushing yourself too hard too often can lead to bad things. It's really hard to do when you're like me, finding the right balance between doing and not doing, while not having enough motivation. Anyway, enough about that, what shall I do to keep myself engaged?
I think I should work on sounds. When I loaded up the game yesterday and was met with background music I was happy. There's something about having music and sounds that makes a game more "real". And, most things in the world create some kind of sound, right? So if I'm going to be adding sounds all over the place I should probably start on that early.
So, I start by creating a new object, the Audio Manager. Make that into a prefab, put my Background Music Audio Source as a child, duplicate it, turn the duplicate into a Sound Effect source. . . adjust some settings, and now I have two sources to address. Let's add a script machine and state machine to the manager. . .
I figure I can just use the same state graph from the health manager to start my audio manager. But I should spice it up, let's make it stick around when we change scenes. . . There's a slight issue though. It doesn't change states properly. Since I'm loading it in the menu, I will have to add a menu state. There's another issue too, detecting scene changes. There does seem to be a way to do this through coding, but I can't figure out how it would be done (using the same api stuffs) in VS. I don't want to check the scene every update. I could just throw in another object that automatically sends a custom trigger with the scene name to all my managers. . . That could work!
With a new tag applied to my managers, I can now pull a list from my scene change manager and send a simple command to each! And it actually works, just gotta remember to add that thing to every scene. . . Luckily there's only two scenes so far, and technically only a single scene transition is possible at this time.
As great as this is, I still haven't added any sounds! I actually should think about how I want to play sound effects. Can a single audio source play more than one thing at a time? Nope! Gonna need multiple audio sources for sound effects. . . damn. I think, at least. I'll use three effects sources for now. I can tag them all the same. Have the audio manager detect whether an audio source is busy, and if not, send the sound there.
Can't fully test it without any sounds though. . . Let's find one! Luckily, I have a bunch of simple SFX already. . . And, it works! Yay, the blaster makes sound! I'll add more sounds as time goes on. Enough for now!
Edit: I couldn't help myself and kept playing with things a bit. I fixed a bug in the volume sliders. Turns out I was adjusting the sliders on start to the previously used volume, but I wasn't actually adjusting the volume itself! Took me a while to work through the logic to get that working, but now it is.
Next up was my feelings about the sound effect sources. I have no idea how many concurrent sound effects my game will end up kicking off, so I decided the best approach was to just use a single source, as a prefab, then instantiate more if that one is busy playing when I want to play another. Eventually there will be a list of clones, which it'll iterate through looking for a free audio source. I had a number of issues getting it working right, but now it's great!
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.