// Use this for initialization void Start() { pinSetter = GameObject.FindObjectOfType <PinSetter>(); actionMaster = GameObject.FindObjectOfType <ActionMasterOld>(); ball = GameObject.FindObjectOfType <BowlingBall>(); pinManager = GameObject.FindObjectOfType <PinManager>(); scoreDisplay = GameObject.FindObjectOfType <ScoreDisplay>(); pinList = new List <int>(); scoreDisplay.UpdateCumulativeScoreTexts(pinList); scoreDisplay.UpdateRollsTexts(pinList); }
// Run when pins have settled private void PinsHaveSettled() { Invoke("ResetBall", 4f); Invoke("UpdatePinCountUIDisplay", 4f); standingPinsText.color = Color.black; int fallenPins = pinManager.GetNumberFallenPins(); pinList.Add(fallenPins); ActionMasterOld.Action action = ActionMasterOld.GetAction(pinList); Debug.Log("Number of fallen pins: " + fallenPins); Debug.Log("Action: " + action); pinSetter.ExecuteAction(action, 1f); scoreDisplay.UpdateCumulativeScoreTexts(ScoreMaster.ScoreCumulative(pinList)); scoreDisplay.UpdateRollsTexts(pinList); ballHasLeftBox = false; standingPinsText.color = Color.black; }