/// <summary> ChangePattern: /// Given a set of patterns of three, the snake changes what order of food would allow it to grow in size and speed /// This function is called once a pattern is complete or interupted. /// </summary> private void ChangePattern() { PreviousPattern = CurrentPattern; NextPattern = FM.NewPattern(); if (NextPattern != CurrentPattern || CurrentPattern == null) { if (FM.CheckTrue(NextPattern)) { CurrentPattern = NextPattern; } else { if (FM.HasAvailablePatterns && !isTutActive) { do { NextPattern = FM.NewPattern(); Debug.Log(string.Format("Failed Test: {0}", NextPattern)); } while (FM.CheckTrue(NextPattern) == false);//|| NextPattern == DefaultPattern CurrentPattern = NextPattern; } } FM.TemporaryTargetReset(); } }