예제 #1
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 ( );
            } );
    }