Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        switch (state)
        {
        case State.None:
            state = State.Prepare;
            break;

        case State.Prepare:
            Init();
            state = State.BattleStart;
            break;

        case State.BattleStart:
            state = State.TurnStart;
            break;

        case State.TurnStart:
            Player cp = (currentTurn == Turn.Self ? SelfPlayer : OpponentPlayer);
            cp.OnTurnStart();
            SetSelectedCard(selectedCard);
            state = State.TurnAction;
            break;

        case State.TurnAction:
            if (events.Count > 0)
            {
                BattleEvent e = events.Peek();
                e.Execute();
                if (e.IsFinished)
                {
                    events.Dequeue();
                }
            }
            break;

        case State.TurnEnd:
            currentTurn = (currentTurn == Turn.Self ? Turn.Opponent : Turn.Self);
            state       = State.TurnStart;
            break;

        case State.BattleEnd:
            break;
        }
    }