100coding
4/4/2017 - 6:37 AM

1B8CE9D2-179D-4243-B1A5-EB2B54FD9CDA

1B8CE9D2-179D-4243-B1A5-EB2B54FD9CDA

using UniRx;
using UnityEngine;

public class Sample : MonoBehaviour
{
    private readonly Subject<string> subject = new Subject<string>();

    private void Start()
    {
        this.subject
            .Where(msg => msg == "Enemy")
            .Subscribe(msg => Debug.Log(string.Format("플레이어가 {0}에 충돌했습니다", msg)));

        this.subject.OnNext("Enemy");
        this.subject.OnNext("Wall");
        this.subject.OnNext("Wall");
        this.subject.OnNext("Enemy");
        this.subject.OnNext("Enemy");
    }
}