Let’s use Reactive Extension to build something a bit more fun: a simple version of Space Invaders. We have twenty aliens distributed inside a 5×4 grid. The game object acting as the container for the aliens move across the screen back and forth and then slowly downwards.
Let’s build a simple breathing exercise app using Unity and UniRX. The application has has two elements, an input text field and a button. You enter a number in the input field and hit the button.
Let me go over a little the details of an Observable and Observer relationship in Rx. So almost anything can be made into an Observable (through custom events, but more on that later). An Observable watches the stream for certain signals, and match them against certain conditions you may specify. Like two Mouse Clicks that happen within half a second from each other.
If you never worked with a Reactive extension api before, it is a bit daunting for sure. I first came to know it while learning functional programming and the concept of immutability and zero side effects. Basically, any application can be seen as an asynchronous collection of signals. This is called the stream. Every game’s […]