This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UniRxUnitTests { | |
[Test] | |
public void ReactiveCommandTest_2() { | |
// Arrange | |
ReactiveProperty<long> CurrentHp = new ReactiveProperty<long>(100); | |
// Only allow when the player is dead | |
// ReactiveCommand Resurrect = CurrentHp.Select(hp=> return hp <= 0).ToReactiveCommand(); | |
int canExecuteCalled = 0; | |
ReactiveCommand Resurrect = CurrentHp.Select(hp=> { canExecuteCalled++; return hp <= 0; }).ToReactiveCommand(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void MergePropertyTest() { | |
// Create an IEnumerable list of reactive proeprties | |
List<ReactiveProperty<int>> rxPropertyList = new List<ReactiveProperty<int>>(); | |
// Add a couple reactive properties | |
rxPropertyList.Add(new ReactiveProperty<int>(1)); | |
rxPropertyList.Add(new ReactiveProperty<int>(2)); | |
// Convert the IEnumerable list to an observable stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using UniRx; | |
using UnityEngine; | |
using System.Threading; | |
namespace UniRx { | |
public static partial class CustomObservable { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace UniRx { | |
public static class SwitchExtensions { | |
public static IObservable<OUT> SwitchSelectWhenTrue<OUT>( this IObservable<bool> observable, Func<IObservable<OUT>> resultIfTrue ) { | |
return observable.Select(value => value == true ? resultIfTrue() : Observable.Empty<OUT>()).Switch(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UniRx; | |
using UniRx.Triggers; | |
using System; | |
[RequireComponent(typeof(Animator))] | |
public class AnimationStateTest : MonoBehaviour { | |
void Start () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Pathfinding; | |
using System.Collections; | |
using UnityEngine; | |
public class LayerGridGraphToggle : MonoBehaviour { | |
public int Width = 200; // (nodes) | |
public int Depth = 200; // (nodes) | |
public float NodeSize = 0.5f; | |
public Vector3 Center = Vector3.zero; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UniRx; | |
using System; | |
/// <summary> | |
/// Spawn prefabs at pre-defined spawn points. | |
/// There can be a delay before spawning, then the prefabs can be spawned in batches with a delay between each batch. | |
/// </summary> | |
public class ListSpawnerRx : MonoBehaviour { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
/// <summary> | |
/// Spawn prefabs at pre-defined spawn points. | |
/// There can be a delay before spawning, then the prefabs can be spawned in batches with a delay between each batch. | |
/// </summary> | |
public class ListSpawner : MonoBehaviour { | |
public GameObject[] PrefabList; | |
public Transform[] SpawnPoints; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UniRx; | |
using UnityEngine.SceneManagement; | |
public class Character { | |
public enum State { | |
Idle, | |
Attacking | |
} | |
public ReactiveProperty<State> CurStateObservable = new ReactiveProperty<State>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UniRx.Triggers; | |
using UniRx; | |
public class DamageVolume : MonoBehaviour { | |
public bool IsNegateVolume = false; | |
void Start () { | |
Collider c = GetComponent<Collider>(); |
OlderNewer