예제 #1
0
        // 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();
        }
예제 #2
0
    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;
    }