예제 #1
0
        private void SetEvent()
        {
            _screen.OnSkillSelected()
            .Subscribe(index =>
            {
                _index = index;
                _targetUseCase.Target(_index);
                _screen.Initialize(_turnCharacter.OnTurnCharacterChanged().Value.SkillEntities().ToList());
            })
            .AddTo(_disposable);

            _screen.OnDirectionChanged()
            .Subscribe(_turnCharacter.OnTurnCharacterChanged().Value.SetDirection)
            .AddTo(_disposable);

            _screen.OnSubmit()
            .Subscribe(_ =>
            {
                _screen.Close();
                _targetSubmitter.OnSubmit();
            })
            .AddTo(_disposable);

            _screen.OnSkip()
            .Subscribe(_ =>
            {
                _targetUseCase.SkipAttack();
                _phaseRegister.SkipAttack();
                _screen.Close();
            })
            .AddTo(_disposable);
        }
예제 #2
0
 public void SkipAttack()
 {
     _phaseRegister.SkipAttack();
 }
예제 #3
0
        public void Initialize()
        {
            var entity = _characterView.GetEntity();

            _character.Initialize(entity.Id, entity, entity.SkillEntities, entity.Owner);
            _enemyRegister.AddEnemy(_character);

            // 移動アニメーション
            _moveLoadProvider.OnLoadSubmit()
            .Where(_ => _characterView.GetEntity() == _turnCharacter.OnTurnCharacterChanged().Value.CharacterEntity)
            .Subscribe(OnMove).AddTo(_disposable);

            _phaseProvider.OnPhaseChanged()
            .Where(phase => phase == GamePhase.Damage)
            .Where(_ => _character == _turnCharacter.OnTurnCharacterChanged().Value)
            .Subscribe(_ =>
            {
                _characterView.OnAnimation(_currentSkill.OnSkillChanged().Value.AnimationState);
                _characterView.OnAnimationEnded()
                .Take(1)
                .Subscribe(animation =>
                {
                    _damagePhaseFinalizer.EmitDamage();
                });
            }).AddTo(_disposable);

            _character.OnDirectionChanged()
            .Subscribe(_characterView.SetRotation).AddTo(_disposable);
            _character.Position()
            .Subscribe(_characterView.SetPosition)
            .AddTo(_disposable);
            _character.OnHpChanged()
            .Where(hp => hp <= 0)
            .Subscribe(_ => _characterView.OnDead())
            .AddTo(_disposable);

            _phaseProvider.OnPhaseChanged()
            .Where(phase => phase == GamePhase.Move)
            .Where(_ => _character == _turnCharacter.OnTurnCharacterChanged().Value)
            .Subscribe(_ =>
            {
                var load          = _cpuUseCase.CpuMove();
                var panelEntities = load.ToList();
                if (panelEntities.Any())
                {
                    _cpuUseCase.MoveCharacter(panelEntities);
                }
                else
                {
                    _phaseRegister.SkipAttack();
                }
            })
            .AddTo(_disposable);

            _phaseProvider.OnPhaseChanged()
            .Where(phase => phase == GamePhase.Attack)
            .Where(_ => _character == _turnCharacter.OnTurnCharacterChanged().Value)
            .Subscribe(_ =>
            {
                if (!_cpuUseCase.CpuAttack())
                {
                    _phaseRegister.SkipAttack();
                }
            })
            .AddTo(_disposable);
        }