Beispiel #1
0
 private void CloseAllLevers(CombinationLever except)
 {
     foreach (var combination in _levers.Keys)
     {
         var lever = _levers[combination];
         if (lever != except)
         {
             lever.Close();
         }
     }
 }
Beispiel #2
0
        private void OnLeverStateChanged(CombinationLever combinationLever)
        {
            int number = combinationLever.Number;

            if (combinationLever.Activated)
            {
                _pulledLeversOrder.Add(number);
                HandleLeversOrderSize();
                if (IsPuzzleSolved())
                {
                    float delayTime = 0.4f;
                    Invoke(nameof(CloseAllLeversPanels), delayTime);
                    GameManager.Instance.NotifyPuzzleSolved(puzzle, delayTime);
                }
            }
            else
            {
                int index = _buttonsPressOrder.FindIndex((x) => x == number);
                if (index > 0)
                {
                    _buttonsPressOrder.RemoveAt(index);
                }
            }
        }