Ejemplo n.º 1
0
    public void StartGame(Action onGameLost, Action onGameWon)
    {
        _player1LegsController.ResetProgress();
        _player2LegsController.ResetProgress();

        _player1Board.DisplayText("", true);
        _player2Board.DisplayText("", true);

        _currentSequence = GetNextSequence();
        _onGameLost      = onGameLost;
        _onGameWon       = onGameWon;
        StartCoroutine(StartGameCoroutine());
    }
Ejemplo n.º 2
0
    private IEnumerator SequenceEndCoroutine(GameplaySequence sequence)
    {
        GameplaySequence sequenceToPlay = null;


        if (sequence.Success)
        {
            Debug.Log("Sequence " + sequence.RequiredScore.ToString() + " won.");
            Dialogue dialogue = GetRandomPositiveDialogue();
            yield return(StartCoroutine(DisplayBoardTextCoroutine(sequence.StartingBoard, dialogue.Sentence, true)));

            yield return(StartCoroutine(DisplayBoardTextCoroutine(sequence.OtherBoard, dialogue.Answer, true)));
        }
        else
        {
            Debug.Log("Sequence " + sequence.RequiredScore.ToString() + " lost.");
            Dialogue dialogue = GetRandomNegativeDialogue();
            yield return(StartCoroutine(DisplayBoardTextCoroutine(sequence.StartingBoard, dialogue.Sentence, false)));

            yield return(StartCoroutine(DisplayBoardTextCoroutine(sequence.OtherBoard, dialogue.Answer, false)));
        }


        LegsController legsToMove = sequence.Success ? GetLowestProgressPlayer() : GetHighestProgressPlayer();

        legsToMove.StepToPosition(sequence.Success, false);

        while (sequence.Legs.IsMoving)
        {
            yield return(null);
        }

        _currentSequence = GetNextSequence();

        if (_currentSequence != null)
        {
            _currentSequence.Start(OnGameplaySequenceFinished);
        }
        else
        {
            EndGame(sequence.Success);
        }
    }
Ejemplo n.º 3
0
 private void OnGameplaySequenceFinished(GameplaySequence sequence)
 {
     StartCoroutine(SequenceEndCoroutine(sequence));
 }