예제 #1
0
    private void HandleNetworkGamePieceMoveEvent(NetworkGamePieceMoveEventArgs args)
    {
        if (m_ActiveGamePieces.ContainsKey(args.PieceNetworkId))
        {
            GamePiece piece = m_ActiveGamePieces[args.PieceNetworkId];

            GameBoardTile destinationTile = m_GameBoardRelative
                                            .GetTileByVector(new Vector2(args.DestinationX, args.DestinationY));

            piece.InitializePathTravel
                (PathHandler.DeterminePath(m_GameBoardRelative, piece.BoardVector, destinationTile));
        }
    }
예제 #2
0
    internal static GameBoardTile[] DeterminePath
        (GameBoardInstance gameBoard, Vector2 origin, GameBoardTile endTile)
    {
        m_Tiles.Clear();

        GameBoardTile currentTile = gameBoard.GetTileByVector(origin);

        int i = 0;

        while (currentTile.BoardVector != endTile.BoardVector && i < 32)
        {
            i++;

            currentTile = GetNextTileInPath
                              (gameBoard, currentTile, endTile.BoardVector);

            if (currentTile == null)
            {
                Debug.LogWarning("Pathing Error: Next Tile In Path Returned Null!");
                return(null);
            }

            if (!m_Tiles.Contains(currentTile))
            {
                m_Tiles.Add(currentTile);
            }
        }

        m_Tiles.Add(endTile); return(m_Tiles.ToArray());
    }
예제 #3
0
 internal void HandleDoubleClick()
 {
     if (m_ParentBoard.SelectionType == SelectionType.Attack)
     {
         GameBoardTile tile = m_ParentBoard.GetTileByVector(BoardVector);
         if (m_ParentBoard.CurrentlySelectedTiles.Contains(tile))
         {
             EventSink.InvokeUnitAttackEvent
                 (new UnitAttackEventArgs(tile));
         }
     }
 }