コード例 #1
0
ファイル: PinSetter.cs プロジェクト: pingevt/bowlmaster
    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
ファイル: GameManager.cs プロジェクト: knevagi/Unity-Games
 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
ファイル: PinSetter.cs プロジェクト: juanpablohdzm/BowlMaster
 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
ファイル: GameManager.cs プロジェクト: GambuzX/FlameWiz
    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
ファイル: GameManager.cs プロジェクト: kianbung/Bao-Lin
    // 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
ファイル: PinSetter.cs プロジェクト: dek7264/Bowlmaster
 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
ファイル: PinSetter.cs プロジェクト: silvaDominic/3D-Bowling
 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
ファイル: PinSetter.cs プロジェクト: alberyan/Bowlmaster
 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
ファイル: PinSetter.cs プロジェクト: aRvBfan/Bowlmaster
    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
ファイル: PinSetter.cs プロジェクト: kianbung/Bao-Lin
 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
ファイル: GameManager.cs プロジェクト: modv93/BowlMaster
 // 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
ファイル: PinSetter.cs プロジェクト: mdegaris/Bowlmaster
    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;
        }
    }