Example #1
0
    /// <summary>
    /// Fake constructor that creates a view piece.
    /// </summary>
    /// <param name="prefab">A prefab reference.</param>
    /// <param name="worldPosition">Where the newrly created view piece will be spawned at.</param>
    /// <param name="team">Which team it lies in.</param>
    /// <param name="parent">A designated parent for sorting.</param>
    /// <param name="boardCoord">A reference to the globalPieceList item.</param>
    /// <returns>A view Piece.</returns>
    public static PieceObject CreatePieceObject(PieceObject prefab, Vector2 worldPosition, PieceColor team, Transform parent, Vector2Int boardCoord)
    {
        PieceObject newPiece = Instantiate(prefab, worldPosition, Quaternion.identity, parent);

        newPiece.SetTeamColor(team);
        newPiece.boardCoordinate = boardCoord;
        return(newPiece);
    }