Example #1
0
    private void OnRingAskingToBeSelected(SelectableRing ring)
    {
        if (!isStarted)
        {
            //the exercise hasn't started yet
            return;
        }

        //Collision to the pin of the ring selected (to avoid innecesary animations)
        lastPinWithCollision = pins[ring.pin].GetInstanceID();

        //Only the last ring can be selected
        if (pins[ring.pin].ringPeek().GetInstanceID() == ring.GetInstanceID())
        {
            //Removing the ring from his current Pin so it can be moved
            pins[ring.pin].ringPop();
            ring.SelectionAllowed();
            aRingIsSelected = true;
        }
                #if UNITY_EDITOR
        else
        {
            aRingIsSelected = true;
            //For QA (have fun Roy!)
            QA_OnRingAskingToBeSelected(ring);
        }
                #endif
    }
Example #2
0
    private void QA_OnRingAskingToBeSelected(SelectableRing ring)
    {
        if (!multipleSelectionAllowed)
        {
            return;
        }


        Pin pin = pins[ring.pin];

        multipleRingSelection.Clear();

        //Select the ring and everything above him
        int selectedIndex = -1;

        for (int i = 0; i < pin.ringsStack.Count; i++)
        {
            //Search for the selected ring
            if (selectedIndex < 0)
            {
                if (pin.ringsStack[i].GetInstanceID() == ring.GetInstanceID())
                {
                    selectedIndex = i;
                    multipleRingSelection.Add(pin.ringsStack[i]);
                }
            }
            else
            {
                //Every ring after the selected should be added
                multipleRingSelection.Add(pin.ringsStack[i]);
            }
        }

        //Remove all the selected rings from the pin
        pin.ringsStack.RemoveRange(selectedIndex, multipleRingSelection.Count);

        //All the selected rings follow the movements of the one selected by the input
        StartCoroutine("MultipleSelectionVisualUpdate");

        //Allow selection and visually select the extra rings
        ring.SelectionAllowed();
        foreach (SelectableRing r in multipleRingSelection)
        {
            r.DoSelectionEffect();
        }

        isMultipleSelectionActive = true;
    }