Exemplo n.º 1
0
        private void RestoreFakeMove(FakeMove fakeMove)
        {
            var selectedPiece    = fakeMove.SelectedPiece;
            var selectedChessMan = fakeMove.SelectedChessMan;
            var newPiece         = fakeMove.NewPiece;
            var newPieceChessMan = fakeMove.NewPieceChessMan;

            selectedPiece.SetChessMan(selectedChessMan);
            selectedChessMan.SetPiece(selectedPiece);

            if (fakeMove.Destroyed)
            {
                newPieceChessMan.SetPiece(newPiece);
                newPiece.SetChessMan(newPieceChessMan);
            }
            else
            {
                newPiece.SetChessMan(null);
            }
        }
Exemplo n.º 2
0
        private FakeMove FakeMoveChessMan(Piece newPiece)
        {
            var selectedPiece    = SelectedPiece.GetComponent <Piece>();
            var selectedChessMan = selectedPiece.GetChessMan();

            var fakeMove = new FakeMove(newPiece, newPiece.GetChessMan(), SelectedPiece, selectedChessMan);

            if (newPiece.GetChessMan())
            {
                newPiece.GetChessMan().SetPiece(null);
                newPiece.SetChessMan(null);
                fakeMove.SetDestroyed();
            }

            newPiece.SetChessMan(selectedChessMan);
            selectedChessMan.SetPiece(newPiece);
            selectedPiece.SetChessMan(null);

            return(fakeMove);
        }