Пример #1
0
        public void Initialize()
        {
            var entity = _characterView.GetEntity();

            _character.Initialize(entity.Id, entity, entity.SkillEntities, entity.Owner);
            _residueCharacter.AddCharacter(_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()
            .Do(_ => _characterView.OnAnimation(AnimationState.Attacked))
            .Where(hp => hp <= 0)
            .Subscribe(_ => _characterView.OnDead())
            .AddTo(_disposable);
        }
Пример #2
0
 public DiceType GetSkillDiceType()
 {
     return(_currentSkill.OnSkillChanged().Value.DiceType);
 }
Пример #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);
        }