Пример #1
0
    void PinsHaveSettled()
    {
        int pinFall = lastSettledCount - CountStanding();

        lastSettledCount = CountStanding();

        ActionMaster.Action action = actionMaster.Bowl(pinFall);
        Debug.Log("pinFall: " + pinFall + " Action: " + action);

        if (action == ActionMaster.Action.Tidy)
        {
            animator.SetTrigger("tidyTrigger");
        }
        else if (action == ActionMaster.Action.EndTurn || action == ActionMaster.Action.Reset)
        {
            lastSettledCount = 10;
            animator.SetTrigger("resetTrigger");
        }
        else if (action == ActionMaster.Action.EndGame)
        {
            throw new UnityException("Don't know how to handle end game yet");
        }

        ball.Reset();
        lastStandingCount     = -1;     // Indicates opins have settled
        ballOutOfPlay         = false;
        standingDisplay.color = Color.green;
    }
Пример #2
0
 public ActionMasterTest()
 {
     endTurn = ActionMaster.Action.EndTurn;
     tidy = ActionMaster.Action.Tidy;
     reset = ActionMaster.Action.Reset;
     endGame = ActionMaster.Action.EndGame;
 }
Пример #3
0
    public void Bowl(int pinFall)
    {
        bowls.Add(pinFall);

        ActionMaster.Action nextAction = ActionMaster.NextAction(bowls);
        pinSetter.PerformAction(nextAction);
        ball.Reset();
    }
Пример #4
0
 public void Bowl(int pinfall)
 {
     bowls.Add(pinfall);
     ActionMaster.Action nextAction = ActionMaster.NextAction(bowls);
     ps.PerformAction(nextAction);
     sd.FillRolls(bowls);
     sd.FillFrames(ScoreMaster.ScoreCumulative(bowls));
     bm.reset();
 }
Пример #5
0
    public void Bowl(int pinFall)
    {
        bowls.Add(pinFall);
        ball.Reset();

        ActionMaster.Action nextAction = ActionMaster.NextAction(bowls);
        pinSetter.PerformAction(nextAction);

        scoreDisplay.FillRollCard(bowls);
    }
Пример #6
0
 public void Animate(ActionMaster.Action action)
 {
     if (action == ActionMaster.Action.Reset || action == ActionMaster.Action.EndTurn)
     {
         animator.SetTrigger("resetTrigger");
     }
     else if (action == ActionMaster.Action.Tidy)
     {
         animator.SetTrigger("tidyTrigger");
     }
 }
Пример #7
0
 public void PinMachine(ActionMaster.Action action)
 {
     if (action == ActionMaster.Action.Tidy)
     {
         animator.SetTrigger("tidyTrigger");
     }
     else if (action == ActionMaster.Action.Reset || action == ActionMaster.Action.EndTurn || action == ActionMaster.Action.EndGame)
     {
         animator.SetTrigger("resetTrigger");
         pinCounter.Reset();                         //Resets to 10 pins standing
     }
 }
Пример #8
0
    //void CheckStandingCount()
    //{
    //    int count = CountStanding();
    //    if (lastStandingCount != count)
    //    {
    //        lastStandingCount = count;
    //        lastChangeTime = Time.time;
    //        return;
    //    }

    //    if (Time.time - lastChangeTime >= 3f)
    //    {
    //        PinsHaveSettled();
    //    }


    //}

    //void PinsHaveSettled()
    //{
    //    int standingPins = CountStanding();
    //    int pinsFall = lastSettledCount - standingPins;
    //    lastSettledCount = standingPins;

    //    // Take Action
    //    ActionMaster.Action action = actionMaster.Bowl(pinsFall);
    //    TakeAction(action);



    //    lastStandingCount = -1;
    //    ballOutOfPlay = false;
    //    numOfStandingPins.color = Color.green;
    //    ball.Reset();
    //}


    public void PerformAction(ActionMaster.Action action)
    {
        if (action == ActionMaster.Action.TIDY)
        {
            animator.SetTrigger("tidyTrigger");
        }
        else if (action == ActionMaster.Action.RESET || action == ActionMaster.Action.END_TURN)
        {
            pinCounter.Reset();
            animator.SetTrigger("resetTrigger");
        }
    }
Пример #9
0
 public void Animation(ActionMaster.Action action)
 {
     if (ActionMaster.Action.EndTurn == action || ActionMaster.Action.Reset == action)
     {
         animator.SetTrigger("ResetTrigger");
         pinCounter.LastSettleCountReset();
     }
     else
     {
         animator.SetTrigger("TidyTrigger");
     }
 }
Пример #10
0
 public void Bowl(int pinFall)
 {
     rolls.Add(pinFall);
     ActionMaster.Action nextAction = ActionMaster.NextAction(rolls);
     if (nextAction == ActionMaster.Action.EndGame)
     {
         levelManager.LoadNextLevel();
     }
     pinSetter.Animation(nextAction);
     scoreDisplay.FillRollCard(rolls);
     scoreDisplay.FillScores(ScoreMaster.ScoreCumulative(rolls));
     ball.BallReset();
 }
Пример #11
0
    public void Bowl(int pinFall)
    {
        bowls.Add(pinFall); //Adiciona a jogada à lista "pins"

        ActionMaster.Action action = ActionMaster.NextAction(bowls);
        pinSetter.triggerAnimation(action);

        List <int> frameScores = ScoreMaster.ScoreCumulative(bowls);

        scoreDisplay.FillFrames(frameScores);
        scoreDisplay.FillRolls(bowls);

        ball.Reset();
    }
Пример #12
0
    public void Bowl(int pinFall)
    {
        bowls.Add(pinFall);
        ActionMaster.Action nextAction = ActionMaster.NextAction(bowls);
        pinSetter.HandleAction(nextAction);
        ball.Reset();

        try {
            scoreDisplay.FillBowls(bowls);
            scoreDisplay.FillFrames(ScoreMaster.ScoreCumulative(bowls));
        } catch {
            Debug.LogError("Could not fill roll card");
        }
    }
Пример #13
0
 private void SetPinCounterMaxPinsForCurrentRollBasedOnNextAction(ActionMaster.Action nextAction, int pinsKnockedDown)
 {
     if (nextAction == ActionMaster.Action.Tidy)
     {
         pinCounter.SetMaxPinsForCurrentRoll(INITIAL_PIN_COUNT - pinsKnockedDown);
     }
     else if (nextAction == ActionMaster.Action.Reset || nextAction == ActionMaster.Action.EndTurn)
     {
         pinCounter.SetMaxPinsForCurrentRoll(INITIAL_PIN_COUNT);
     }
     else if (nextAction == ActionMaster.Action.EndGame)
     {
         throw new UnityException("Don't know how to handle EndGame!");
     }
 }
Пример #14
0
    // TODO move to GameMaster when ready
    public void PinsHaveSettled(int pinsFallen)
    {
        scoreList.Add(pinsFallen);

        //ActionMaster.Action action = actionMaster.Bowl(pinsFallen); // take action based on last round (if first frame)

        ActionMaster.Action action = ActionMaster.NextAction(scoreList); // variable size scorelist??! holy shit does that work?

        pinSetter.PerformAction(action);

        print(pinsFallen);
        print(action);

        ball.Reset();
    }
Пример #15
0
 public void PerformAction(ActionMaster.Action actionToPerform)
 {
     if (actionToPerform == ActionMaster.Action.Tidy)
     {
         animator.SetTrigger("tidyTrigger");
     }
     else if (actionToPerform == ActionMaster.Action.Reset || actionToPerform == ActionMaster.Action.EndTurn)
     {
         animator.SetTrigger("resetTrigger");
     }
     else if (actionToPerform == ActionMaster.Action.EndGame)
     {
         throw new UnityException("Don't know how to handle EndGame!");
     }
 }
Пример #16
0
    // Lane performs next action based on list of bowls and
    // handles edge case actions
    private void NextAction()
    {
        // Get next action and set pins
        ActionMaster.Action nextAction = ActionMaster.NextAction(bowls);
        pinSetter.SetPins(nextAction);

        if (nextAction != ActionMaster.Action.Tidy)
        {
            lastSettledCount = 10;
        }
        if (nextAction == ActionMaster.Action.EndGame)
        {
            Invoke("LoadEndScreen", 5);
        }
    }
Пример #17
0
 public void ActionExcecutor(ActionMaster.Action act)
 {
     if (act == ActionMaster.Action.Tidy)
     {
         aN.SetTrigger("TidyTrigger");
         raising = true;
     }
     else if (act == ActionMaster.Action.EndTurn || act == ActionMaster.Action.Reset)
     {
         aN.SetTrigger("ResetTrigger");
         pc.Reset();
     }
     else if (act == ActionMaster.Action.EndGame)
     {
     }
 }
Пример #18
0
    // Control animation triggers based on ActionMaster action
    public void SetPins(ActionMaster.Action action)
    {
        Debug.Log(action);
        switch (action)
        {
        case ActionMaster.Action.Tidy:
            animator.SetTrigger("tidyTrigger");
            break;

        case ActionMaster.Action.EndGame:
        case ActionMaster.Action.EndTurn:
        case ActionMaster.Action.Reset:
            animator.SetTrigger("resetTrigger");
            break;
        }
    }
Пример #19
0
 public void PerformAction(ActionMaster.Action action)
 {
     if (action == ActionMaster.Action.Tidy)
     {
         animator.SetTrigger("tidyTrigger");
     }
     else if (action == ActionMaster.Action.Reset || action == ActionMaster.Action.EndTurn)
     {
         animator.SetTrigger("resetTrigger");
         pinCounter.Reset();
     }
     else if (action == ActionMaster.Action.EndGame)
     {
         throw new UnityException("Endgame not implemented yet");
     }
 }
Пример #20
0
 public void PerformAction(ActionMaster.Action action)
 {
     if (action == ActionMaster.Action.Tidy)
     {
         anim.SetTrigger("triggerCleanUp");
     }
     else if (action == ActionMaster.Action.EndGame)
     {
         throw new UnityException("Not sure how to handle END GAME scenario");
     }
     else
     {
         anim.SetTrigger("triggerReset");
         pinCounter.Reset();
     }
 }
Пример #21
0
 public void PerformAction(ActionMaster.Action action)
 {
     if (action == ActionMaster.Action.Tidy)
     {
         animator.SetTrigger("tidyTrigger");
     }
     else if (action == ActionMaster.Action.Reset || action == ActionMaster.Action.EndTurn)
     {
         pinCounter.Reset();
         animator.SetTrigger("resetTrigger");
     }
     else if (action == ActionMaster.Action.EndGame)
     {
         throw new UnityException("Don't know how to handle end game yet");
     }
 }
Пример #22
0
    private void PinsHaveSettled()
    {
        int standing = CountStanding();
        int pinFall  = lastSettleCount - standing;

        lastSettleCount = standing;

        ActionMaster.Action action = actionMaster.Bowl(pinFall);

        HandleAction(action);
        Debug.Log("Pinfall: " + pinFall + " " + action);

        ball.Reset();
        lastStandingCount     = -1; //indicates pins have settled, and ball not back in box
        ballLeftBox           = false;
        standingDisplay.color = Color.green;
    }
Пример #23
0
    public void Bowl(int pinFall)
    {
        bowls.Add(pinFall);
        ActionMaster.Action nextAction = ActionMaster.NextAction(bowls);
        pinSetter.PerformAction(nextAction);

        try
        {
            scoreDisplay.UpdateScore(bowls, ScoreMaster.ScoreFrames(bowls));
        }
        catch (UnityException e) {
            Debug.Log("Unable to upate score.");
            Debug.Log(e.ToString());
        }

        ball.Reset();
    }
Пример #24
0
 public void Bowl(int pinFall)
 {
     try{
         rolls.Add(pinFall);
         ball.Reset();
         ActionMaster.Action nextAction = ActionMaster.NextAction(rolls);
         pinSetter.PerformAction(nextAction);
     }catch {
         Debug.LogWarning("Error");
     }
     try{
         scoreDisplay.FillRolls(rolls);
         scoreDisplay.FillFrames(ScoreMaster.ScoreCumulative(rolls));
     }catch {
         Debug.LogWarning("fillrollcards failed");
     }
 }
Пример #25
0
    public void Bowl(int fallenPins)
    {
        bowlsList.Add(fallenPins);
        ball.Reset();
        List <int> modListPlayerOne = ScoreMaster.ScoreFramesHelper(bowlsList);

        scoreDisplay.FillRolls(modListPlayerOne);
        scoreDisplay.FillFrames(modListPlayerOne);
        ActionMaster.Action nextAction = ActionMaster.NextAction(this.bowlsList);
        pinSetter.PinsHaveSetteled(nextAction);
        if (nextAction == ActionMaster.Action.EndGame)
        {
            playerFinalScore = scoreDisplay.finalScore;
            SetHighestScoringPlayerInGameMode();
            Invoke("LoadNextLevel", 5f);                // loads leaderboard scene
        }
    }
Пример #26
0
 public void PinsHaveSetteled(ActionMaster.Action actionToTake)
 {
     if (actionToTake == ActionMaster.Action.EndGame)
     {
         //throw new UnityException ("End Game");
         this.ResetTrigger();
         pinCounter.ResetSettleCount();
     }
     if (actionToTake == ActionMaster.Action.Tidy)
     {
         this.TidyTrigger();
     }
     else
     {
         this.ResetTrigger();
         pinCounter.ResetSettleCount();
     }
 }
Пример #27
0
 public void PerformAction(ActionMaster.Action action)
 {
     if (action == ActionMaster.Action.Tidy)
     {
         animator.SetTrigger("tidyTrigger");
         pinCounter.ResetLastSettled(false);
     }
     else if (action == ActionMaster.Action.EndTurn)
     {
         animator.SetTrigger("resetTrigger");
         pinCounter.ResetLastSettled(true);
     }
     else     // need to expand to consider other actions, but fine for now
     {
         animator.SetTrigger("resetTrigger");
         pinCounter.ResetLastSettled(true);
     }
 }
Пример #28
0
 public void Bowl(int pinFall)
 {
     try{
         bowls.Add(pinFall);
         ActionMaster.Action nextAction = ActionMaster.NextAction(bowls);
         pinSetter.PerformAction(nextAction);
     } catch {
         Debug.LogWarning("Something went wrong in Bowl");
     } try{
         scoreDisplay.FillBowls(bowls);
         scoreDisplay.FillFrameScores(ScoreMaster.ScoreCumulative(bowls));
     } catch {
         Debug.LogWarning("FillRollCard Failed");
     }
     ball.Reset();
     inPlayTime = 25f;
     GameOver();
 }
Пример #29
0
 // Update is called once per frame
 public void Bowls(int pinFall)
 {
     try{
         rolls.Add(pinFall);
         ball.Reset();
         ActionMaster.Action nextAction = ActionMaster.NextAction(rolls);
         pinSetter.PerformAction(nextAction);
     }catch {
         Debug.Log("There is some problem in performing action");
     }
     try{
         scoreDisplay.FillRollCard(rolls);
         scoreDisplay.FillFrames(ScoreMaster.ScoreCumulative(rolls));
     }
     catch {
         Debug.Log("There's an error while fiiling the score card");
     }
 }
Пример #30
0
    public void performAction(ActionMaster.Action action)
    {
        Debug.Log("Action: " + action);

        switch (action)
        {
        case ActionMaster.Action.Tidy:
            animator.SetTrigger("tidyTrigger");
            break;

        case ActionMaster.Action.Reset:
        case ActionMaster.Action.EndTurn:
        case ActionMaster.Action.EndGame:
            animator.SetTrigger("resetTrigger");
            pinCounter.Reset();
            break;
        }
    }
Пример #31
0
    public void DoAction(ActionMaster.Action action)
    {
        Debug.Log("DoAction: " + action);

        switch (action)
        {
        case ActionMaster.Action.Tidy:
            this.Tidy();
            this.pinCounter.Reset();
            break;

        case ActionMaster.Action.Reset:
        case ActionMaster.Action.EndTurn:
            this.Reset();
            this.pinCounter.Reset(endTurn: true);
            break;
        }
    }