public void UpdateCash(long cash) { NumberRoller numberRoller = cashText.gameObject.GetComponent <NumberRoller>(); if (numberRoller == null) { numberRoller = cashText.gameObject.AddComponent <NumberRoller>(); } numberRoller.enabled = false; numberRoller.Setup(currentCash, cash, 1f, () => { currentCash = cash; numberRoller.enabled = false; }); numberRoller.enabled = true; }
//For moving along the board, triggered by NumberRoller public IEnumerator MoveToPoint(int diceRoll, NumberRoller callback) { for (int i = 0; i < diceRoll; i++) { yield return(StartCoroutine(MoveToTarget(iceCubes [position < 17 ? position + 1 : 0]))); } //Finished moving, enable roll button. callback.enabledButton = true; //Display front penguin view frontguin.SetActive(true); sideguin.SetActive(false); //Enable sprites for forward facing penguin frontBackSprites(true); anim.Play("front_idle"); }
void Start() { //Set up singleton for referencing instance = this; }