예제 #1
0
 protected override void Start()
 {
     this.OnPointerDownAsObservable()
     .Subscribe(_ =>
     {
         _playerDataUseCase.RecoverPlayer(1000);
         _enemyDataUseCase.RecoverEnemy(1000);
     })
     .AddTo(this);
 }
예제 #2
0
        public override async UniTask <GameState> TickAsync(CancellationToken token)
        {
            await UniTask.Delay(TimeSpan.FromSeconds(1f), cancellationToken : token);

            await _enclosureObjectUseCase.AttackAsync(token, data =>
            {
                // TODO: PlayerのStatusを反映させる
                switch (data.enclosureObjectType)
                {
                case EnclosureObjectType.Bullet:
                    _enemyDataUseCase.DamageEnemy(data.effectValue);
                    break;

                case EnclosureObjectType.Bomb:
                    _playerDataUseCase.DamagePlayer(data.effectValue);
                    break;

                case EnclosureObjectType.Heart:
                    _playerDataUseCase.RecoverPlayer(data.effectValue);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            });

            _stockPositionCommander.ResetStockPosition();

            await UniTask.Delay(TimeSpan.FromSeconds(1f), cancellationToken : token);

            if (_playerDataUseCase.IsAlivePlayer() == false)
            {
                return(GameState.Failed);
            }
            else if (_enemyDataUseCase.IsAliveEnemy())
            {
                return(GameState.Damage);
            }
            else
            {
                return(GameState.Clear);
            }
        }