예제 #1
0
    // Handles the bowls (rolls) made by players
    public void Bowl(int pinFall)
    {
        List <int> bowls = currentPlayer.GetBowls();

        try{
            bowls.Add(pinFall);
            ActionMaster.Action nextAction = ActionMaster.NextAction(bowls);
            pinSetter.PinMachine(nextAction);
            UpdateScore(bowls);

            if (nextAction == ActionMaster.Action.Tidy)
            {
                StartCoroutine(IsSwiping(5.5f, true));
            }

            if (nextAction == ActionMaster.Action.EndTurn)
            {
                StartCoroutine(IsSwiping(5.5f, false));
            }
            else if (nextAction == ActionMaster.Action.EndGame)
            {
                currentPlayer.PlayerFinishedGame();
                StartCoroutine(IsSwiping(5.5f, false));
            }
        }catch {
            Debug.LogError("Something went wrong in Bowl()");
        }
    }