void PinsHaveSettled() { int standing = CountStanding(); int pinFall = lastSettledCount - standing; lastSettledCount = standing; ActionMaster.Action action = actionMaster.Bowl(pinFall); if (action == ActionMaster.Action.Tidy) { animator.SetTrigger("tidyTrigger"); } else if (action == ActionMaster.Action.EndTurn) { animator.SetTrigger("resetTrigger"); lastSettledCount = 10; } else if (action == ActionMaster.Action.Reset) { animator.SetTrigger("resetTrigger"); lastSettledCount = 10; } else if (action == ActionMaster.Action.EndGame) { throw new UnityException("Don't know how to handle end game yet"); } ball.Reset(); lastStandingCount = -1; // Indicates pins have settled, and ball not back in box ballOutOfPlay = false; standingDisplay.color = Color.green; }
public void ActionMasterHandler() { int pinsFallen = lastSettledCount - CountStanding(); lastSettledCount = CountStanding(); Debug.Log("Pins knocked down: " + pinsFallen); ActionMaster.Action action = actionMaster.Bowl(pinsFallen); Debug.Log(action); if (action == ActionMaster.Action.Tidy) { animator.SetTrigger("tidyTrigger"); } else if (action == ActionMaster.Action.Reset) { animator.SetTrigger("resetTrigger"); lastSettledCount = 10; } else if (action == ActionMaster.Action.EndTurn) { animator.SetTrigger("resetTrigger"); lastSettledCount = 10; } else if (action == ActionMaster.Action.EndGame) { throw new UnityException("End game action not set."); } }
public void StateActions() { ActionMaster.Action action = actionMaster.Bowl(CountFallenPins()); Debug.Log(action); if (action == ActionMaster.Action.Tidy) { animator.SetTrigger("tidyTrigger"); } else if (action == ActionMaster.Action.EndTurn) { animator.SetTrigger("resetTrigger"); lastSettledCount = 10; } else if (action == ActionMaster.Action.Reset) { animator.SetTrigger("resetTrigger"); lastSettledCount = 10; } else if (action == ActionMaster.Action.EndGame) { throw new UnityException("Don't know how to handle end-game yet"); } }
void PinsHaveSettled() { int pinsFallen = lastSettledCount - CountStanding(); lastSettledCount = CountStanding(); lastStandingCount = -1; // indicate pins have settled ballExitedLane = false; text.color = Color.cyan; ball.Reset(); ActionMaster.BowlAction whatToDo = actionMaster.Bowl(pinsFallen); switch (whatToDo) { case (ActionMaster.BowlAction.Tidy): TidyPins(); break; case (ActionMaster.BowlAction.EndTurn): case (ActionMaster.BowlAction.Reset): RenewPins(); break; case (ActionMaster.BowlAction.EndGame): throw new UnityException("dont know how to end game yet"); } }
void PinsHaveSettled() { int pinFall = lastSettledCount - CountStanding(); lastSettledCount = CountStanding(); ActionMaster.Action action = actionMaster.Bowl(pinFall); Debug.Log("You just hit: " + pinFall + " pins." + " Current action: " + action); if (action == ActionMaster.Action.Tidy) { animator.SetTrigger("tidyTrigger"); } else if (action == ActionMaster.Action.EndTurn) { animator.SetTrigger("resetTrigger"); lastSettledCount = 10; } else if (action == ActionMaster.Action.Reset) { animator.SetTrigger("resetTrigger"); lastSettledCount = 10; } else if (action == ActionMaster.Action.EndGame) { throw new UnityException("Still thinking how to handle End Game."); } ball.Reset(); lastStandingCount = -1; ballOutOfPlay = false; standingDisplay.color = Color.green; }
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; }
public static Action NextAction(List<int> pinFalls) { ActionMaster am = new ActionMaster(); Action currentAction = new Action(); foreach (int pinFall in pinFalls) { currentAction = am.Bowl(pinFall); } return currentAction; }
//takes list of previous pinfalls and returns next action //static so can be called directly from the class public static Action NextAction(List <int> pinFalls) { ActionMaster am = new ActionMaster(); Action currentAction = new Action(); foreach (int pinFall in pinFalls) { currentAction = am.Bowl(pinFall); } return(currentAction); }
private int bowl = 1; //丟出保齡球的次數 public static Action NextAction(List <int> pinFalls) { ActionMaster actionMaster = new ActionMaster(); Action nextAction = new Action(); foreach (int pinFall in pinFalls) { nextAction = actionMaster.Bowl(pinFall); } return(nextAction); }
public static ActionState NextAction(List<int> pinFalls) { ActionMaster actionMaster = new ActionMaster(); ActionState currentAction = new ActionState(); foreach (int pinFall in pinFalls) { currentAction = actionMaster.Bowl (pinFall); } return currentAction; }
public void T04FinalFrameStrikeGrantsTwoExtraTurns(){ foreach (int i in Enumerable.Range(0, 20)) { if (i == 19){ Assert.AreEqual(reset, actionMaster.Bowl(10)); Assert.AreEqual(tidy, actionMaster.Bowl(3)); Assert.AreEqual(endGame, actionMaster.Bowl(3)); }else { actionMaster.Bowl(3); } } // foreach (int i in Enumerable.Range(0, 20)) { actionMaster = new ActionMaster(); foreach (int i in Enumerable.Range(0, 20)) { if (i == 19){ Assert.AreEqual(reset, actionMaster.Bowl(10)); Assert.AreEqual(reset, actionMaster.Bowl(10)); Assert.AreEqual(endGame, actionMaster.Bowl(10)); }else { actionMaster.Bowl(3); } } // foreach (int i in Enumerable.Range(0, 20)) { } // public void T04FinalFrameStrikeGrantsTwoExtraTurns(){
public static Action NextAction(List <int> pinsFall) { ActionMaster actionMaster = new ActionMaster(); Action result = new Action(); foreach (int pins in pinsFall) { result = actionMaster.Bowl(pins); } return(result); }
// and now you're thinking with portals // so this is how you recycle code instead of redoing everything from scratch public static Action NextAction(List <int> pinFalls) { ActionMaster am = new ActionMaster(); // instantiate new ActionMaster and currentAction, so don't f**k with numbers Action currentAction = new Action(); foreach (int pin in pinFalls) { currentAction = am.Bowl(pin); // cycle and loop Bowl(), until the last action is received } return(currentAction); }
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; }
public static Action NextAction(List <int> pinFalls) { //takes a list of pinFalls from GameManager and returns the next action //I guess then we need to get the latest pinFall from the list Action lastActionReturned = new Action(); ActionMaster staticActionMaster = new ActionMaster(); int county = 0; foreach (int pinFall in pinFalls) { lastActionReturned = staticActionMaster.Bowl(pinFall, pinFalls); Debug.Log("Pinfall index of " + county + " with pinfall " + pinFall + " gave action of " + lastActionReturned); county++; } return(lastActionReturned); }
void PinsHaveSettled() { ball.Reset(); standingPinsText.color = Color.green; lastSettledCount -= CountStanding(); ActionMaster.Action action = actionMaster.Bowl(lastSettledCount); Debug.Log(action + " " + lastSettledCount); if (action.Equals(ActionMaster.Action.TIDY)) { animator.SetTrigger("tidyTrigger"); } else { lastSettledCount = 10; animator.SetTrigger("resetTrigger"); } lastStandingCount = -1; ballLeftBox = false; }
void PinsHaveSettled() { int countStanding = CountStanding(); int pinFall = lastSettledCount - countStanding; lastSettledCount = countStanding; var action = actionMaster.Bowl(pinFall); if (action == ActionMaster.BowlResult.Tidy) { animator.SetTrigger("TidyTrigger"); } else if (action == ActionMaster.BowlResult.EndTurn) { animator.SetTrigger("resetTrigger"); lastSettledCount = 10; } ball.Reset(); LastStandingCount = -1; BallLeftBox = false; TextCount.color = Color.green; }
public void T01OneStrikeReturnsEndTurn() { Assert.AreEqual(endTurn, actionMaster.Bowl(10)); }
public void T01BowlNotTenReturnsTidy(){ foreach (int i in Enumerable.Range(0, 9)){ actionMaster = new ActionMaster(); Assert.AreEqual(tidy, actionMaster.Bowl(i)); } }
public void T00InvalidPinCount() { Assert.Throws <UnityException>(() => actionMaster.Bowl(-1)); }
public void T01SingleStrikeEndsTurn() { Assert.AreEqual(endTurn, actionMaster.Bowl(10)); }
public void T01OneStrikereturnsEndTurn() { Assert.AreEqual(endturn, a.Bowl(10)); }
public void TestBowlStrikeEndsTurn() { ActionMaster.BowlResult result = actionMaster.Bowl(10); Assert.AreEqual(ActionMaster.BowlResult.EndTurn, result); }