// Player snake growth needs to handle zooming out the camera, and updating the score text public override void GrowSnake() { base.GrowSnake(); // zoom out if (tail.Count > GetStartingLength()) { PlayerNetworkController parentScript = this.transform.parent.GetComponent <PlayerNetworkController>(); parentScript.ZoomCamera(1.0f); //ZoomCamera(1.0f); } lengthText.text = "Length: " + tail.Count.ToString(); }
// a thread to drop tail links while boosted IEnumerator DropTailLinks() { while (true) { yield return(new WaitForSeconds(0.9f)); if (boosted && tail.Count > startingLength) { ShrinkSnake(); PlayerNetworkController parentScript = this.transform.parent.GetComponent <PlayerNetworkController>(); parentScript.ZoomCamera(-1.0f); //ZoomCamera(-1.0f); lengthText.text = "Length: " + tail.Count.ToString(); } else { break; } } StopCoroutine(DropTailLinks()); }