Gunner Rail Shooter

First of all I need to say that despite the fact that I’m not new in C# and Unity I gave some real afford to make one level of rail-shooter. I didn’t follow Rick’s guide but try to use all things that he provided as challenges.
So what goes wrong with my game.

Summary

Animation is most painful part. I decided to make map small and it’s good for making less time of animation, but it means that it needed more variation, and that wasn’t easy to make. So first advice make your map bigger. It’ll save you time on making animation. If you like me and decide to make small rotations very wavy kind of movements, then be ready that you need to struggle with animation curves. Rick relies on grid when he make his animation, which means every rectangle on grid is particular duration of time, for example half of second. I ignored his advice and have been punished) I thought Unity will adapt animation curves somehow to match my weird movement. None of these happened)
I was to lazy to remade movement and start to rebuild curves which took lot of time, and all I got it’s linear movement. And I decided to make a little bit different game. Which is kind of weird flying machine gun. What you need to know if you didn’t follow Rick’s steps like me.
If you ending up making animation for specific gameobject you can add it to main timeline, but your animation will played with offset because timeline is gameobject and has its transform. So you need to use Clip Transform Offsets settings to move it where you actually need. It not easy but it’s not making another animation. I think it good idea to make two gameobjects, one for positioning and one for rotation, so you can make timeline of path movement and then add rotation on top of positioning. Also it is good idea to make x/z position movement first and upper/lower after.

Well enough of animation. Let’s move to new input system. It’s not longer in beta state. This means no more weird compiling errors. I really struggle to find any information on how to get Mouse X Y kind of information of it like it was in old system. Suddenly it appears that there is a preset of typical controls and you can use it as unity events or at least take a look how to build your own controls.
To understand why it’s better to use new input system you need to understand how to use events and delegates in Unity. Main idea is to make your code less dependent on Update method, less dependent on referencing classes, so you can make your code more reusable. So in my case I just use preset to read values of look event to execute public methods in Player Controller and it’s really few lines of code. It isn’t ideal but it work this way. The only thing I did it clamp my camera angle with Rick’s advice.

I know that this wasn’t in current lectures but I used coroutine a lot for continuous firing and some effects. And it was interesting problem with it. I made wave of enemy with timeline, and control on maintimeline deactivate wave timeline object and enemy fighter with it. When gameobject deactivated it stops any coroutine inside. And because my firing coroutine method executed with Start my flying turrets didn’t want to fire)

If you’re in a mood to play

2 Likes

Privacy & Terms