Beispiel #1
0
    /// <summary>
    /// Uses the Mad Hatter ability by swapping two pieces.
    /// </summary>
    public void UseMadHatter( Tile t1, Tile t2, Info info )
    {
        //Store temporary value
        Piece temp = t1.currentPiece;

        //Swap pieces
        t1.currentPiece.currentTile = t2;
        t2.currentPiece.currentTile = t1;
        t1.currentPiece = t2.currentPiece;
        t2.currentPiece = temp;

        //Bring pieces to front
        t1.currentPiece.sprite.sortingOrder = 2;
        t2.currentPiece.sprite.sortingOrder = 2;

        //Animate mad hatter
        Sequence s = DOTween.Sequence ( )
            .Append ( t1.currentPiece.transform.DOMove ( t1.transform.position, ANIMATE_TIME ) )
            .Insert ( 0, t2.currentPiece.transform.DOMove ( t2.transform.position, ANIMATE_TIME ) )
            .OnComplete ( () =>
            {
                //Deactivate ability
                info.abilityInUse.IsActive = false;
                info.DisableAbility ( info.abilityInUse.ID, info.currentPlayer );

                //Enable abilities use buttons
                info.EnableAbilityButtons ( );

                //Reset ability selection list
                info.abilityTileSelection.Clear ( );

                //Reset board
                info.ResetBoardColor ( );

                //Highlight pieces
                info.HighlightCurrentPlayerPieces ( );
            } );
    }
Beispiel #2
0
    /// <summary>
    /// Uses the Nonagression Pact by marking two pieces that cannot interact with one another.
    /// </summary>
    public void UseNonagressionPact( Tile t1, Tile t2, Info info )
    {
        //Add each piece as each other's nonagression partner
        t1.currentPiece.nonagressionPartners.Add ( t2.currentPiece.color );
        t2.currentPiece.nonagressionPartners.Add ( t1.currentPiece.color );

        //Animate nonaggression pact
        Sequence s = DOTween.Sequence ( )
            .Append ( t1.currentPiece.sprite.DOColor ( new Color32 ( 150, 50, 255, 255 ), ANIMATE_TIME ).SetLoops ( 2, LoopType.Yoyo ) )
            .Insert ( 0, t2.currentPiece.sprite.DOColor ( new Color32 ( 150, 50, 255, 255 ), ANIMATE_TIME ).SetLoops ( 2, LoopType.Yoyo ) )
            .OnComplete ( () =>
            {
                //Deactivate ability
                info.abilityInUse.IsActive = false;
                info.DisableAbility ( info.abilityInUse.ID, info.currentPlayer );

                //Enable abilities use buttons
                info.EnableAbilityButtons ( );

                //Reset ability selection list
                info.abilityTileSelection.Clear ( );

                //Reset board
                info.ResetBoardColor ( );

                //Highlight pieces
                info.HighlightCurrentPlayerPieces ( );
            } );
    }
Beispiel #3
0
    /// <summary>
    /// Uses the Grim Reaper ability by moving the player's Grim Reaper piece to its new tile.
    /// </summary> 
    public void UseGrimReaper( Piece p, Tile t, Info info )
    {
        //Store piece color
        Color c = p.sprite.color;

        //Animate grim reaper
        Sequence s = DOTween.Sequence ( )
            .Append ( p.currentTile.sprite.DOColor ( Color.black, ANIMATE_TIME ).SetLoops ( 2, LoopType.Yoyo ) )
            .Insert ( 0, p.sprite.DOColor ( Color.black, ANIMATE_TIME ) )
            .Insert ( ANIMATE_TIME, p.sprite.DOFade ( 0, 0 ) )
            .AppendCallback ( () =>
            {
                //Move the player's Grim Reaper piece
                p.currentTile.currentPiece = null;
                p.currentTile = t;
                t.currentPiece = p;
                p.Move ( t.transform.position );
            } )
            .Append ( t.sprite.DOColor ( Color.black, ANIMATE_TIME ).SetLoops ( 2, LoopType.Yoyo ) )
            .Insert ( ANIMATE_TIME * 3, p.sprite.DOFade ( 1, 0 ) )
            .Insert ( ANIMATE_TIME * 3, p.sprite.DOColor ( c, ANIMATE_TIME ) )
            .OnComplete ( () =>
            {
                //Reset grim reaper tile
                info.grimReaperTile = null;

                //Hide prompt
                info.currentPlayer.prompt.gameObject.SetActive ( false );

                //Store temporary save data
                info.TempSave ( );

                //Reset board
                info.ResetBoardColor ( );

                //Highlight pieces
                info.HighlightCurrentPlayerPieces ( );
            } );
    }