Giter Site home page Giter Site logo

rxsandbox's Introduction

👋 hi

This project has some examples to play around with and get familiar with Rx in Unity:

Sandbox Capture

A super bare bones scene with heavily commented files to show the basics of streams and Subjects.

Puma Capture

This example shows the progress of a fictitious Puma progressing trough a fictitious world.

The PumaProgress is used to calculate a position and to trigger animations along the way. The value can be changed in the inspector.

The animations ProgressProp convert the progress to a target scale and only start a new animation when the in range boolean value changes (using DistinctUntilChanged).

HealthBar Capture

This example shows a slow health bar and commands.

The health bars use a single health value as input. The slow part just uses Throttle to delay the animation until it is not changing for a short while.

The normalized health value is calculated using the reactive max health property, so when either value changes, the normalized values changes with it.

The commands use the same health source to determine their can execute state.

Note that you can also change the health value in the inspector directly and everything still updates accordingly.

Coffee Capture

This example shows the setup of the worlds weirdest coffee bar. Random coffee orders are generated at intervals or at manual request.

The total cost of all emitted orders is calculated dynamically using the Scan operator. And it combines multiple input streams (Intervals and a manual subject) to generate a healthy coffee order stream.

Using the OfType<TSource, TOutput> it filters on the only correct coffee choice and show a little effect when that is ordered.

A very important thing to get your head around is the Share operator on the intervals in SomewhatFancierExample3. Without it each subscription would initiate a new, fresh set of intervals, starting at the moment of subscription. Even worse, since we're selecting random coffees from the interval, without it each subscriber would get a different stream of coffees.

Start with the {Sandbox](Assets/Examples/Sandbox/) example, where the basics can be explored. After that check the somewhat fancier examples: , and . Each example has an accompanying README file with more info.

Peggle-ish Capture

This example demonstrates different, not necessarily the best, ways of using observables.

🔗 links

rxsandbox's People

Contributors

besttof avatar

Stargazers

1122 avatar Edu Garcia avatar victrolaface avatar  avatar Adam Hill avatar  avatar Lorena Weder avatar chimera kang avatar d avatar Erick Bazán avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.