コード例 #1
0
        private void ProcessSequenceCompleted()
        {
            StoredMoves.Add(CurrentPieces.Select(x => x).ToList());

            if (StoredMoves.Count >= MovesAllowedPerTurn)
            {
                foreach (var currentMoves in StoredMoves)
                {
                    SequenceCompleted?.Invoke(currentMoves.ToArray());
                    LogUsedPieces(currentMoves);

                    foreach (var square in currentMoves)
                    {
                        if (square.OnCollection != null)
                        {
                            square.OnCollection.OnCollection();
                        }
                        square.DestroyPiece();
                    }
                }
                MoveCompleted?.Invoke();

                StoredMoves.Clear();
                ResetMovesAllowedPerTurn();
            }

            CurrentPieces.Clear();
            SelectedPiecesChanged?.Invoke(CurrentPieces);
        }
コード例 #2
0
 private void Printer_PrintFinished(object sender, PrintFinishedEventArgs e)
 {
     if (isPrinting)
     {
         PrintFinished?.Invoke(this, e);
         isPrinting = false;
         isHomed    = false;
     }
     if (isFilamentChanging && filamentChangeBegin)
     {
         FilamentChangeBegin?.Invoke(this, e);
         filamentChangeBegin = false;
         videoIsPlaying      = true;
         isHomed             = false;
     }
     if (isFilamentChanging && filamentChangeEnd)
     {
         FilamentChangeEnd?.Invoke(this, e);
         filamentChangeEnd = false;
         isHomed           = false;
     }
     if (isMovedManually)
     {
         isMovedManually = false;
         MoveCompleted?.Invoke(this, null);
     }
 }
コード例 #3
0
        public void Move(int discs, Stack <int> from, Stack <int> to, Stack <int> auxilary)
        {
            if (discs > 0)
            {
                Move(discs - 1, from, auxilary, to);

                to.Push(from.Pop());
                MovesCount++;
                MoveCompleted?.Invoke(this, EventArgs.Empty);
                Move(discs - 1, auxilary, to, from);
            }
        }
コード例 #4
0
        private void Move(int discs, Stack <int> from, Stack <int> to, Stack <int> temp)
        {
            if (discs > 0)
            {
                Move(discs - 1, from, temp, to);

                to.Push(from.Pop());
                MovesCount++;
                MoveCompleted?.Invoke(this, EventArgs.Empty);

                Move(discs - 1, temp, to, from);
            }
        }
コード例 #5
0
    public void MoveTo(Vector3[] positions, float timePerUnit,
                       MoveCompleted moveCompleted, MoveInterrupted moveInterrupted)
    {
        if (_moveFunction != null)
        {
            if (_moveInterrupted != null)
            {
                _moveInterrupted();
            }

            StopCoroutine(_moveFunction);
            _moveFunction = null;
        }

        _moveCompleted   = moveCompleted;
        _moveInterrupted = moveInterrupted;

        _moveFunction = HandleMoveTo(positions, timePerUnit);

        StartCoroutine(_moveFunction);
    }
コード例 #6
0
 protected void FireMoveCompleted()
 {
     MoveCompleted?.Invoke(this);
 }