public void Bowl(int pinFall) { pinFalls.Add(pinFall); ActionMaster2.Action nextAction = ActionMaster2.NextAction(pinFalls); pinSetter.PerformAction(nextAction); try { scoreDisplay.FillRolls(pinFalls); scoreDisplay.FillFrames(ScoreMaster.ScoreCumulative(pinFalls)); } catch { Debug.LogWarning("Something went wrong in Bowl()"); } ball.Reset(); dragLaunch.Reset(); }
///////////////////////////////////////////////////////////////////////////////////////////// void PinsHaveSettled() { int pinsNotStanding = lastSettledCount - PinCounter.amountPinsStanding(); //gets the amount of pins fell (reminder that lastSettledCount equals 10 at this point) lastSettledCount = PinCounter.amountPinsStanding(); //updates last settledcount List <int> pinsNotStandingList = new List <int>(); //Makes a list so it can be processed by the actionmaster, which ONLY takes lists pinsNotStandingList.Add(pinsNotStanding); ActionMaster2.Action action = ActionMaster2.NextAction(pinsNotStandingList); //Makes an action based on pinsNotStandingList. switch (action) //if action... { case ActionMaster2.Action.Tidy: // PinSetter.anim.SetTrigger("tidyTrigger"); break; case ActionMaster2.Action.Reset: PinSetter.anim.SetTrigger("resetTrigger"); break; case ActionMaster2.Action.EndGame: throw new UnityException("Implement the endgame fool"); break; case ActionMaster2.Action.EndTurn: PinSetter.anim.SetTrigger("resetTrigger"); break; } ball.BallReset(); //reset ball to old pos, removes velocity, etc lastUprightCount = -1; //Reintialization lastChangeTime = 0; ///Reintialization PinSetter.ballTouched = false; //Reintialization thaScore.color = Color.green; //make the text green b/c fun //Pin[] oldPins = FindObjectsOfType<Pin>(); //gets all the pins that exist //foreach (Pin pin in oldPins) {Destroy (pin.gameObject);} //Gets every pin in oldPins and destroys them //Instantiate (pins, this.transform.position, Quaternion.identity); //then make new ones!! }
public void PerformAction(ActionMaster2.Action action) { if (action == ActionMaster2.Action.Tidy) { animator.SetTrigger("tidyTrigger"); Debug.Log("Tidy trigger triggered."); } else if (action == ActionMaster2.Action.EndTurn) { animator.SetTrigger("resetTrigger"); pinCounter.bowlStartPinCount = 10; //reset 球道時場上瓶子數為10 Debug.Log("Reset trigger triggered."); } else if (action == ActionMaster2.Action.Reset) { animator.SetTrigger("resetTrigger"); pinCounter.bowlStartPinCount = 10; //reset 球道時場上瓶子數為10 Debug.Log("Reset trigger triggered."); } else if (action == ActionMaster2.Action.EndGame) { throw new UnityException("not sure what to do yet"); } }