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); }
public void SkipAttack() { _phaseRegister.SkipAttack(); }
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); }