Ejemplo n.º 1
0
    //Lock pin state and exclude from selectable pins
    private void HoldPin()
    {
        Behaviour_LockPin controls = SelectedPin.GetComponent <Behaviour_LockPin>();

        controls.dropped = true;
        controls.holding = true;
        pinsLeft         = new List <GameObject>();
        pinsLeft.AddRange(UI_Lock.ActivePins.Except(HoldPins));
        HoldPins.Add(SelectedPin);
        var tempSelectedPin = SelectedPin;

        if (SelectedPin != pinsLeft[pinsLeft.Count - 1])
        {
            SelectedPin = pinsLeft[pinsLeft.FindIndex(x => x == SelectedPin) + 1];
        }
        else if (SelectedPin != pinsLeft[0])
        {
            SelectedPin = pinsLeft[pinsLeft.FindIndex(x => x == SelectedPin) - 1];
        }
        pinsLeft.Remove(tempSelectedPin);
        CollectPrecedingPins();
        currentPosition += 1;
        if (currentPosition >= UI_Lock.ActivePins.Count)
        {
            if (!UI_Lock.currentLock.unlocked)
            {
                UI_Lock.currentLock.unlocked = true;
            }
            else
            {
                UI_Lock.currentLock.unlocked = false;
            }
            SelectedAnim.Rebind();
            gameObject.SetActive(false);
        }
    }