Exemplo n.º 1
0
        private void Start()
        {
            _hpObservable.Value = maxHp * 0.7f;
            _hpObservable
            .TakeUntil(_hpObservable.Where(hp => hp <= 0))
            .Subscribe(hp =>
            {
                var colorSeed  = hp * 0.01f;
                renderer.color = new Color(1, 1, 1, colorSeed);
            },
                       () =>
            {
                DiedAsync.OnNext(Unit.Default);
                DiedAsync.OnCompleted();
                Debug.Log("Dead");
            }).AddTo(gameObject);
            _hpObservable.First(x => x < weakedHp).Subscribe(x => ResetAnim());

            this.UpdateAsObservable()
            .TakeUntil(_hpObservable.Where(hp => hp <= 0))
            .Where(_ => !isSayingHelloObservable.Value)
            .Select(_ => Input.GetMouseButtonDown(0)).Where(x => x)
            .Subscribe(_ =>
            {
                SayHello();
            }).AddTo(gameObject);
        }
Exemplo n.º 2
0
 public void Die()
 {
     DiedAsync.OnNext(Unit.Default);
     DiedAsync.OnCompleted();
 }