Example #1
0
    /// <summary>
    /// Doubles the move to.
    /// </summary>
    /// <param name="happyMove">Happy move.</param>
    private void DoubleMoveTo(MoveSet.Move happyMove)
    {
        // for each piece
        for (int i = 0; i < pieces.Count(); i++)
        {
            Vector3[] locations = new Vector3[happyMove.movementNodes.Length];

            for (int m = 0; m < happyMove.movementNodes.Length; m++)
            {
                if (pieces[i].flipped)
                {
                    locations[m]    = happyMove.movementNodes[m].BasePosition;
                    locations[m].y += (25f * (i + 1f)) + baseY;
                }
                else
                {
                    locations[m]    = happyMove.movementNodes[m].BasePosition;
                    locations[m].y += (25f * i) + baseY;
                }
            }

            pieces[i].MultiMoveTo(locations);
        }

        node.tower = null;
        happyMove.GetDest().tower = this;
        node = happyMove.GetDest();
        Debug.Assert(pieces.Count() != 0, "Attempt to move a tower with no pieces");
    }
Example #2
0
 /// <summary>
 /// Moves to.
 /// </summary>
 /// <param name="happyMove">Happy move.</param>
 public void MoveTo(MoveSet.Move happyMove)
 {
     if (happyMove.hookInvolved)
     {
         DoubleMoveTo(happyMove);
     }
     else
     {
         MoveTo(happyMove.GetDest());
     }
 }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="src">from this tile</param>
 /// <param name="dest">to this tile</param>
 /// <param name="srcMoves">set of legal moves for source tower</param>
 public PieceMove(TileNode src, MoveSet.Move destMove, HashSet <TileNode> srcMoves)
 {
     Debug.Assert(src != null, "PieceMove src is null when creating one");
     this.src = src;
     if (destMove != null)
     {
         this.dest = destMove.GetDest();
         Debug.Assert(dest != null, "PieceMove dest is null when creating one");
         this.destMove = destMove;
         moves         = srcMoves;
         firstTower    = src.tower;
         secondTower   = dest.tower;
     }
 }