// Defines what should happen when balls have been succesfully dispersed private static void OnDispersed() { int index = numberList.GetIndexOfNode(newlyInsertedNode); // Check for combo // Suggestion for improvement: onderstaande functie een array aanleveren zodat je alleen het deel // van de ketting bekijkt waar: // - De bal net is ingekomen // - De delen die niet door dit deel van de ketting worden aangeraakt // worden niet in acht genomen if (numberList.CheckForComboAt(index, target)) { nextBallValue = UnityEngine.Random.Range(NumberList.BOUND_LOW, NumberList.BOUND_HIGH); } nodeDestroyer.DestroyDeadNodes(); // Check win condition if (numberList.nodeLinkedList.Count == 0) { UnityEngine.Debug.Log("GUTTER CLEARED! Game won!"); GameStateManager.SwitchToWon(); return; } GetValidTarget(); // Reset the newly inserted node newlyInsertedNode = null; // Switch the gamestate to resetting GameStateManager.SwitchToResetting(); ScoreAdd.ReduceScore(); }
private static void OnDispersed() { int index = numberList.GetIndexOfNode(newlyInsertedNode); if (numberList.CheckForComboAt(index, target)) { target = UnityEngine.Random.Range(NumberList.BOUND_LOW, NumberList.BOUND_HIGH); } newlyInsertedNode = null; dispersing = false; }