Exemple #1
0
    private void Update()
    {
        switch (nowState)
        {
        case BattleSceneState.BATTLE_START:
            OnBattleStart?.Invoke(this, EventArgs.Empty);
            nowState = BattleSceneState.PLAYER_TURN_START;
            OnPlayerTurnStart?.Invoke(this, EventArgs.Empty);
            break;

        case BattleSceneState.PLAYER_TURN_START:
            if (!BattleEventManager.Instance.Execute())
            {
                nowState = BattleSceneState.PLAYER_TURN_UPDATE;
            }
            break;

        case BattleSceneState.PLAYER_TURN_UPDATE:
            break;

        case BattleSceneState.PLAYER_TURN_END:
            if (!BattleEventManager.Instance.Execute())
            {
                nowState = BattleSceneState.ENEMY_TURN_START;
                OnEnemyTurnStart?.Invoke(this, EventArgs.Empty);
            }
            break;

        case BattleSceneState.ENEMY_TURN_START:
            if (!BattleEventManager.Instance.Execute())
            {
                nowState = BattleSceneState.ENEMY_TURN_UPDATE;
            }
            break;

        case BattleSceneState.ENEMY_TURN_UPDATE:
            if (!BattleEventManager.Instance.Execute())
            {
                nowState = BattleSceneState.ENEMY_TURN_END;
                OnEnemyTurnEnd?.Invoke(this, EventArgs.Empty);
            }
            break;

        case BattleSceneState.ENEMY_TURN_END:
            if (!BattleEventManager.Instance.Execute())
            {
                nowState = BattleSceneState.PLAYER_TURN_START;
                OnPlayerTurnStart?.Invoke(this, EventArgs.Empty);
            }
            break;

        case BattleSceneState.BATTLE_END:

            break;
        }
    }
    private IEnumerator Play()
    {
        if (secondDrawnCard.IsHidden)
        {
            secondDrawnCard.SetCardHidden(canTryToHideTheSecondCard = false, shouldAnimate: true);
        }

        CalculateHandTotal();

        while (handTotal < stoppingNumber && IsFeelingConfident())
        {
            Hit();
            yield return(StartCoroutine(DisplayHand(canTryToHideTheSecondCard)));

            CalculateHandTotal();
        }


        yield return(new WaitForSeconds(1f));

        OnEnemyTurnEnd?.Invoke(handTotal);
    }