コード例 #1
0
 //Resets the lists highlight.
 private void ResetSelection()
 {
     for (int i = 0; i < results.Count; i++)
     {
         NodeObject obj = globalNodeViewList.Find(p => p.boardCoordinate == results[i]);
         obj.OnInteract();
     }
 }
コード例 #2
0
    private void Reset()
    {
        if (storedObject != null)
        {
            storedObject.OnInteract();
        }

        if (results != null || results.Count != 0)
        {
            ResetSelection();
        }
    }
コード例 #3
0
    //This method handles the interaction between the raycast information and the piece search and movement logic.
    void OnInteraction(NodeObject node)
    {
        #region Reset
        Reset();
        #endregion

        if (node == null)
        {
            return;
        }
        //If the node is confirmed to be a target, move the stored piece to it.
        if (ConfirmTarget(node, results))
        {
            target = node.boardCoordinate;
            MovePiece(currentPiece, target, OwnedViewPieces, ref hasntDoneFirstMove);
            results.Clear();
        }
        //If the piece is not confirmed to be a valid piece, return the method.
        if (!ConfirmingPiece(node, TestBoardModel.globalPieceList))
        {
            return;
        }

        //This section checks for the current Piece. If the hasntDoneFirstMOve is equal to false, always return the target as its new piece. Otherwise, Confirm if the found node is indeed a piece.
        storedObject = node;
        currentPiece = (!hasntDoneFirstMove) ? target : (ConfirmingPiece(node, TestBoardModel.globalPieceList)) ? node.boardCoordinate : currentPiece;

        if (globalPieceList.Any(p => p.pos == currentPiece && p.belongsTo != currentTeam))
        {
            return;
        }
        storedObject.OnInteract("#00ff00");

        //If the hasntDoneFIrstMove is equal to false, use the target as a baseline for searching for any available paths. Otherwise, use the found node as a baseline for searching any available paths.
        results = FindPotentialPaths(node.boardCoordinate, new List <Vector2Int> (), hasntDoneFirstMove);
        HighlightSelection();
    }