Extended arbor plugin for unirx.
C#
Switch branches/tags
Nothing to show
Clone or download
Latest commit bfbac2a Oct 11, 2016
Permalink
Failed to load latest commit information.
Behaviours fitst commit Oct 1, 2016
Examples remove japanese Oct 1, 2016
Internal Add stateAwakeStream Oct 1, 2016
.gitattributes fitst commit Oct 1, 2016
.gitignore fitst commit Oct 1, 2016
README.md Add UnityPackage Oct 2, 2016
koinonia.config.json RequiresFullReimport is false Oct 11, 2016

README.md

ArborRx

This is expansion plugin of Arbor2. I simplify cooperation with UniRx.

Getting started

Example

Please define StateBehaviour with a method to return IObservable<Unit>

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UniRx;

namespace ArborRx.Examples
{
    public class Onkey : ObservableStateBehaviour
    {
        public KeyCode keycode;

        Subject<Unit> onKeyStream = new Subject<Unit>();
        Subject<Unit> onKeyDownStream = new Subject<Unit>();
        Subject<Unit> onKeyUpStream = new Subject<Unit>();

        public IObservable<Unit> OnKeyAsObservable()
        {
            return onKeyStream.AsObservable();
        }

        public IObservable<Unit> OnKeyDownAsObservable()
        {
            return onKeyDownStream.AsObservable();
        }

        public IObservable<Unit> OnKeyUpObservable()
        {
            return onKeyUpStream.AsObservable();
        }

        void Awake()
        {
            updateAsObservable.Where(_ => Input.GetKey(keycode)).Subscribe(_ => onKeyStream.OnNext(Unit.Default));
            updateAsObservable.Where(_ => Input.GetKeyDown(keycode)).Subscribe(_ => onKeyDownStream.OnNext(Unit.Default));
            updateAsObservable.Where(_ => Input.GetKeyUp(keycode)).Subscribe(_ => onKeyUpStream.OnNext(Unit.Default));
        }
    }
}

Subscribe to a stream from an editor screen of Arbor when you use ObserveTransition and change.

gif