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.IO.Ports; | |
using UnityEngine; | |
using UniRx; | |
public class Serial : MonoBehaviour { | |
[SerializeField]private string _portName; | |
[SerializeField]private int _baurate; |
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
byte x = 0; | |
byte y= 0; | |
byte z = 0; | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { |
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 UniRx; | |
using UnityEngine; | |
namespace Gauge | |
{ | |
public class Model : MonoBehaviour | |
{ | |
[SerializeField] private IntReactiveProperty _value = new IntReactiveProperty(0); | |
public IReadOnlyReactiveProperty<int> Value => _value; |
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 UniRx; | |
using UnityEngine; | |
namespace Gauge | |
{ | |
public class Presenter : MonoBehaviour | |
{ | |
[SerializeField] private Model _model; | |
[SerializeField] private View _view; |
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 TMPro; | |
using UniRx; | |
using UnityEngine; | |
using UnityEngine.UI; | |
using DG.Tweening; | |
namespace Gauge | |
{ | |
public class View : 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; | |
public class Observer1 : MonoBehaviour | |
{ | |
[SerializeField] private Subject1 _subject; | |
// Update is called once per frame | |
void Update() | |
{ | |
if (Input.GetKeyDown(KeyCode.Space)) |
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 Random = UnityEngine.Random; | |
public class Subject1 : MonoBehaviour | |
{ | |
private Action<int> OnComplete ; | |
public void Subscribe(Action<int> _action) | |
{ | |
OnComplete = _action; |
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 interface IObserver<in T> | |
{ | |
void OnCompleted();//発行後のコールバック | |
void OnError(Exception error);//エラー発生時の通知 | |
void OnNext(T value);//通知する | |
} | |
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 interface IObservable<out T> | |
{ | |
IDisposable Subscribe(IObserver<T> observer);//購読処理 | |
} |
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 interface IDisposable | |
{ | |
void Dispose();観察対象の破棄で使う | |
} |
OlderNewer