Ejemplo n.º 1
0
 public void Initialize()
 {
     _targetProvider.OnTargetCharacters()
     .Where(targets => targets.Count != 0)
     .Subscribe(targets => _targets = targets)
     .AddTo(_disposable);
 }
Ejemplo n.º 2
0
        public void Initialize()
        {
            // StandBy phase to Move phase
            _turnCharacter.OnTurnCharacterChanged()
            .Subscribe(_ => _phaseRegister.OnNextPhase())
            .AddTo(_disposable);

            // Move phase to Attack phase
            _moveHandler.OnMoveEvent()
            .Subscribe(_ => _phaseRegister.OnNextPhase())
            .AddTo(_disposable);

            // Attack phase to Dice phase
            _skillModel.OnSkillSubmit()
            .Subscribe(_ => _phaseRegister.OnNextPhase())
            .AddTo(_disposable);

            // Dice phase to Damage phase
            _damageProvider.OnDamageChanged()
            .Subscribe(_ => _phaseRegister.OnNextPhase())
            .AddTo(_disposable);

            // Damage phase to End phase
            _targetProvider.OnTargetCharacters()
            .Subscribe(targets =>
            {
                _targets.Dispose();
                var stream = targets.Select(c => c.OnHpChanged()).Merge();
                _targets   = stream
                             .Buffer(stream.Throttle(TimeSpan.FromMilliseconds(100)))
                             .Subscribe(_ => _phaseRegister.OnNextPhase());
            })
            .AddTo(_disposable);
        }