Exemplo n.º 1
0
        public override async UniTask <GameState> TickAsync(CancellationToken token)
        {
            await DOTween.Sequence()
            .Append(enemyImage.rectTransform
                    .DOAnchorPosY(-900f, _animationTime)
                    .SetEase(Ease.Linear))
            .Join(enemyImage.rectTransform
                  .DOScale(Vector3.one * 1.25f, _animationTime)
                  .SetEase(Ease.OutBack))
            .WithCancellation(token);

            _playerDataUseCase.DamagePlayer(_enemyDataUseCase.enemyEntity.GetAttack());

            await DOTween.Sequence()
            .Append(enemyImage.rectTransform
                    .DOAnchorPosY(-25f, _animationTime)
                    .SetEase(Ease.Linear))
            .Join(enemyImage.rectTransform
                  .DOScale(Vector3.one, _animationTime))
            .WithCancellation(token);

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

            if (_playerDataUseCase.IsAlivePlayer())
            {
                return(GameState.Ready);
            }
            else
            {
                return(GameState.Failed);
            }
        }
Exemplo n.º 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);
            }
        }