public override bool Equals(object otherObject)
        {
            PuzzleVirtualCoordinates otherCoordinates = otherObject as PuzzleVirtualCoordinates;

            if (otherCoordinates == null)
            {
                return(false);
            }

            return(otherCoordinates.Row == Row && otherCoordinates.Column == Column);
        }
示例#2
0
        /// <summary> Обмен местами на виртуальной и визуальной доске двух пазлов </summary>
        private void SwapToPuzzles(AbstractPuzzleTileFacade firstPuzzle, AbstractPuzzleTileFacade secondPuzzle)
        {
            Vector3 firstPuzzleVector = firstPuzzle.transform.position;
            PuzzleVirtualCoordinates firstPuzzleCoordinates = firstPuzzle.CurrentCoordinates;

            firstPuzzle.transform.position = secondPuzzle.transform.position;
            firstPuzzle.CurrentCoordinates = secondPuzzle.CurrentCoordinates;

            secondPuzzle.transform.position = firstPuzzleVector;
            secondPuzzle.CurrentCoordinates = firstPuzzleCoordinates;

            virtualFieldOfPuzzles[GetPuzzleRow(firstPuzzle), GetPuzzleCol(firstPuzzle)]   = firstPuzzle;
            virtualFieldOfPuzzles[GetPuzzleRow(secondPuzzle), GetPuzzleCol(secondPuzzle)] = secondPuzzle;
        }
示例#3
0
        /// <summary> Вызвать евент об окончании обмена мест с пустым пазлом </summary>
        private Action RaiseOnSwapEnded(AbstractPuzzleTileFacade otherPuzzleTile)
        {
            Action newOnSwaped = () =>
            {
                //После завершения физического перемещения, необходимо обновить координаты
                PuzzleVirtualCoordinates emptyPuzzleCoordinates = otherPuzzleTile.CurrentCoordinates;
                otherPuzzleTile.CurrentCoordinates = this.CurrentCoordinates;
                this.CurrentCoordinates            = emptyPuzzleCoordinates;

                //Вызываем соответствующее событие
                if (OnSwapEndedEvent != null)
                {
                    OnSwapEndedEvent.Invoke(this, otherPuzzleTile);
                    OnSwapEndedEvent = null;
                }
            };

            return(newOnSwaped);
        }