Coder Social home page Coder Social logo

ander456 / awaitable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wkzhou1988/awaitable

0.0 1.0 0.0 16.65 MB

This is a naive design of classes to write await/async game logics instead of coroutines in Unity.

License: MIT License

C# 100.00%

awaitable's Introduction

Awaitable

A naive implementation of custom awaitable type.

When writing game logics in Unity, I often find myself writing lots of callbacks. Now I want to avoid the callback hell using await and async feature. However, using the default provided Task, you can not fully control the update behaviour of your tasks, while it is a common feature to implement something like slow motion or pause feature in your games. In these situations, you will want to have full control over the update behaviour of you tasks. The advantage of coroutine is that you can use yield return to write better async code, but the downside is coroutines can not have retuen values. You can use Tasks, but you can not control the update. So I wrote these base classes to provide a foundation to build your own awaitable classes while they are updated by a MonoBehaviour.

I provide here is just a foundation, or an idea of implementing such a thing. There is no test code nor examples at this stage. It is up to you to extend or modify so that they fit into your design and your game.

Any sugguestions are welcomed!

awaitable's People

Contributors

wkzhou1988 avatar

Watchers

James Cloos 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.