示例#1
0
 // to spawn a new object dropping out of the box by gravity
 public void spawnNew(JSFPieceDefinition pd, Vector3 pos, float dropSpeed, int skinNum)
 {
     isActive = true;
     piece    = new JSFGamePiece(pd, this, skinNum, position - pos);
     piece.init();
     applyTweening(dropSpeed);
 }
示例#2
0
    // power merge ability code
    void doSpecial6Power(int[] arrayRef, JSFGamePiece target, JSFGamePiece refPiece)
    {
        gm.audioScript.bombSoundFx.play();         // play this sound fx

        float delayPerPiece = 0.05f;

        gm.animScript.doAnim(JSFanimType.Special6, arrayRef);        // visual fx animation

        // destroy the special 6 piece to avoid re-occurence loop
        gm.destroyInTimeMarked(refPiece.master, 0f, scorePerPiece);

        for (int x = 0; x < gm.boardWidth; x++)
        {
            for (int y = 0; y < gm.boardHeight; y++)
            {
                // code below fans out the destruction with the bomb being the epicentre
                if ((arrayRef[0] - x) >= 0 && (arrayRef[1] - y) >= 0)
                {
                    gm.destroyInTime(arrayRef[0] - x, arrayRef[1] - y, delayPerPiece * (x + y), scorePerPiece);
                }
                if ((arrayRef[0] + x) < gm.boardWidth && (arrayRef[1] + y) < gm.boardHeight)
                {
                    gm.destroyInTime(arrayRef[0] + x, arrayRef[1] + y, delayPerPiece * (x + y), scorePerPiece);
                }
                if ((arrayRef[0] - x) >= 0 && (arrayRef[1] + y) < gm.boardHeight)
                {
                    gm.destroyInTime(arrayRef[0] - x, arrayRef[1] + y, delayPerPiece * (x + y), scorePerPiece);
                }
                if ((arrayRef[0] + x) < gm.boardWidth && (arrayRef[1] - y) >= 0)
                {
                    gm.destroyInTime(arrayRef[0] + x, arrayRef[1] - y, delayPerPiece * (x + y), scorePerPiece);
                }
            }
        }
    }
示例#3
0
    private void OnPointerClick(JSFGamePiece gp)
    {
        if (currentlyClickedGP == gp)
        {
            clickCount++;
        }
        else
        {
            clickCount = 1;

            currentlyClickedGP = gp;
        }

        if (clickCount == 2)//double click
        {
            //display description and gameobject
            //var description = descriptions[Array.FindIndex(gp.pd.skin, x => x.name == gp.thisPiece.name.Replace("(Clone)",""))];
            gm.DisplayPieceDescription(gp);

            clickCount         = 0;
            currentlyClickedGP = null;
        }
        else
        {
            StartCoroutine(TickDown());
        }
    }
示例#4
0
    // power merge ability code
    IEnumerator doPowerMergeFiveX(int[] arrayRef, JSFGamePiece target, JSFGamePiece refPiece, int slotNum)
    {
        gm.audioScript.bombSoundFx.play();                          // play this sound fx

        gm.destroyInTimeMarked(refPiece.master, 4f, scorePerPiece); // destroys only after the delay

        // visual effect for a time bomb
        Vector3 newSize = Vector3.Scale(refPiece.thisPiece.transform.localScale, new Vector3(1.45f, 1.45f, 1f));

        LeanTween.scale(refPiece.thisPiece, newSize, 0.5f).setLoopPingPong();
        refPiece.thisPiece.GetComponent <JSFPieceTracker>().enabled = false;

        StartCoroutine(specialFiveColored(refPiece.master.arrayRef, target, refPiece, slotNum, 0f, false)); // color specific rainbow bust
        gm.pieceManager.GetComponent <JSFBombPiece>().doBombPower(target.master.arrayRef, 2);               // do the T match (big ver.) power!
        yield return(new WaitForSeconds(2f));                                                               // wait for 2 secs

        int color = Random.Range(0, gm.NumOfActiveType);                                                    // choose a random color..

        while (color == slotNum)
        {
            color = Random.Range(0, gm.NumOfActiveType);            // make sure it's not the same color as previous
        }
        StartCoroutine(specialFiveColored(refPiece.master.arrayRef, target, refPiece,
                                          color, 2f, true));         // blows up another color...
    }
示例#5
0
 // when the piece is added to the swipe chain (after addToSwipeChain() )
 public virtual void onSwipeAdded(JSFGamePiece gp, bool isBoardCheck)
 {
     // isBoardCheck == true if the board is checking for legal swipes (use it in if-else when needed!)
     // default does nothing...
     // suggest calling "JSFSwipeManager.allowAnyColorOnce()" here to allow the next piece
     //     to be added without color limitation :)
 }
示例#6
0
 // when the piece is being removed 1 by 1 (swipe is valid and being processed)
 // this is per piece call function
 public virtual void onSwipeValidating(JSFGamePiece gp)
 {
     if (gp.markedForDestroy)
     {
         return;                                                                    // already marked for future destroy, do not proceed...
     }
     gm.increaseScore(scorePerPiece, gp.master.arrayRef[0], gp.master.arrayRef[1]); // increase score
     foreach (JSFBoard neighbour in gp.master.allNeighbourBoards)                   // to all its neighbour boards
     {
         neighbour.SplashDamage();                                                  // splash damage call (causes splash damage)
     }
     if (JSFSwipeManager.lastSwipeChainBoard == gp.master)                          // if this is the last piece of the swipe
     {
         for (int w = gm.pieceTypes.Length - 1; w >= 0; w--)
         {
             if (gm.pieceTypes[w].createPowerAtSwipeEnd(gp, JSFSwipeManager.currentSwipeCount))
             {
                 return;                     // finished here..
             }
         }
         gp.master.destroyBox();             // no power created... destroys the piece here
     }
     else
     {
         gp.master.destroyBox();             // destroys the piece here ( default )
     }
 }
示例#7
0
 // when the swipe is backtracked to this piece during a swipe
 public override void onSwipeBackTracked(JSFGamePiece gp, bool isBoardCheck)
 {
     // isBoardCheck == true if the board is checking for legal swipes (use it in if-else when needed!)
     // default does nothing...
     // this is called when a swipe back-tracked to this piece :)
     // suggest re-calling "JSFSwipeManager.allowAnyColorOnce()" here (if needed)
     //     to allow the next piece to be added without color limitation :)
 }
示例#8
0
    // function called when user starts the first swipe touch (the first piece)
    public override bool useAsFirstSwipe(JSFGamePiece gp, bool isBoardCheck)
    {
        // isBoardCheck == true if the board is checking for legal swipes (use it in if-else when needed!)
        // return true to allow SwipeManager to use this piece as a starting swipe
        // return false to NOT allow SwipeManager to use this piece as a starting swipe

        JSFSwipeManager.allowAnyColorOnce();
        return(true);
    }
示例#9
0
 public override void onPieceDestroyed(JSFGamePiece gp)
 {
     // play audio visuals
     if (gm.audioScript.treasureCollectedFx.Length > 0)
     {
         gm.audioScript.treasureCollectedFx[Random.Range(0, gm.audioScript.treasureCollectedFx.Length - 1)].play(); // play this sound fx
     }
     gm.animScript.doAnim(JSFanimType.TREASURECOLLECTED, gp.master.arrayRef[0], gp.master.arrayRef[1]);             // instantiate this anim
 }
示例#10
0
 public override bool createPowerAtSwipeEnd(JSFGamePiece gp, int swipeLength)
 {
     if (swipeLength >= gm.minSwipeMatch + 2) // meet min swipe + 2 length
     {
         gp.master.convertToSpecial(this);    // convert to this power :)
         gp.master.panelHit();                // hits the panel as well...
         return(true);
     }
     return(false);
 }
示例#11
0
    // function called when user starts the first swipe touch (the first piece)
    public override bool useAsFirstSwipe(JSFGamePiece gp, bool isBoardCheck)
    {
        // isBoardCheck == true if the board is checking for legal swipes (use it in if-else when needed!)
        // return true to allow SwipeManager to use this piece as a starting swipe
        // return false to NOT allow SwipeManager to use this piece as a starting swipe

        // below is the default behaviour
        // if it's not a special... set the swipeColor to the slotNum; use as first swipe
        JSFSwipeManager.allowAnyColorOnce();         // rainbow swipe the next piece..
        return(true);
    }
示例#12
0
    // spawn a new piece on the board itself (appear mode) which scales from small to big
    public void spawnNewAppear(JSFPieceDefinition pd, float appearSpeed, int skinNum)
    {
        isActive = true;
        piece    = new JSFGamePiece(pd, this, skinNum, position);
        piece.init();
        LeanTween.cancel(piece.thisPiece);         // cancel any active tweens on this object
        float scaleSize = piece.thisPiece.transform.localScale.x;

        piece.thisPiece.transform.localScale = Vector3.zero;         // appear from scale 0

        LeanTween.value(piece.thisPiece, appearTweeningSubFunction, 0f, scaleSize, appearSpeed).setOnUpdateParam(piece.thisPiece);
    }
示例#13
0
    // only used these functions...
    // view more ovveridable functions in PieceDefinition.cs script itself OR
    // check out aPieceTemplate.cs script

    public override bool powerMerge(List <JSFBoard> chain, JSFGamePiece target,
                                    JSFGamePiece refPiece, int[] arrayRef, bool isACheck)
    {
        if (target.pd is JSFVerticalPiece || target.pd is JSFHorizontalPiece)
        {
            if (!isACheck)
            {
                doPowerMergeHV(arrayRef); // do a power merge power
            }
            return(true);                 // <--- has power merge
        }
        return(false);                    // <--- no power merge
    }
示例#14
0
 public override bool createPowerAtSwipeEnd(JSFGamePiece gp, int swipeLength)
 {
     if (swipeLength >= gm.minSwipeMatch + 2)         // meet min swipe + 2 length
     {
         if (gp.master.top == JSFSwipeManager.secondLastSwipeChainBoard ||
             gp.master.bottom == JSFSwipeManager.secondLastSwipeChainBoard) // swipe upwards or downwards
         {
             gp.master.convertToSpecial(this);                              // convert to this power :)
             gp.master.panelHit();                                          // hits the panel as well...
             return(true);
         }
     }
     return(false);
 }
示例#15
0
 // when the swipe is illegal, void and being removed...
 // this is per piece call function
 public static void onSwipeFailed(JSFGamePiece gp)
 {
     // -----------------------------------
     // your own stuff here... before swipe fail call
     // -----------------------------------
     gp.pd.onSwipeFailed(gp);         // piece definition relay call
     if (dlgOnSwipeFailed != null)
     {
         dlgOnSwipeFailed.Invoke(gp);
     }
     // -----------------------------------
     // your own stuff here... after swipe fail call
     // -----------------------------------
 }
示例#16
0
 // when the piece is being removed 1 by 1 (swipe is valid and being processed)
 // this is per piece call function
 public static void onSwipeValidating(JSFGamePiece gp)
 {
     // -----------------------------------
     // your own stuff here... before piece validation
     // -----------------------------------
     gp.pd.onSwipeValidating(gp);         // piece definition relay call
     if (dlgOnSwipeValidating != null)
     {
         dlgOnSwipeValidating.Invoke(gp);
     }
     // -----------------------------------
     // your own stuff here... after piece validation
     // -----------------------------------
 }
示例#17
0
    // when a swipe was back tracked... (already happened!)
    public static void onSwipeBackTracked(JSFGamePiece gp, bool isBoardCheck)
    {
        gp.pd.onSwipeBackTracked(gp, isBoardCheck);        // piece definition relay call
        // -----------------------------------
        // your own stuff here...
        // you can call JSFSwipeManager for swipe related variables
        // e.g. > "JSFSwipeManager.swipeColor" <-- returns slotNum of type int

        // -----------------------------------

        if (dlgOnSwipeBackTracked != null)
        {
            dlgOnSwipeBackTracked.Invoke(gp, isBoardCheck);
        }
    }
示例#18
0
    // function called when user starts the first swipe touch (the first piece)
    public virtual bool useAsFirstSwipe(JSFGamePiece gp, bool isBoardCheck)
    {
        // isBoardCheck == true if the board is checking for legal swipes (use it in if-else when needed!)
        // return true to allow SwipeManager to use this piece as a starting swipe
        // return false to NOT allow SwipeManager to use this piece as a starting swipe

        // below is the default behaviour
        // if it's not a special... set the swipeColor to the slotNum; use as first swipe
        if (!isSpecial)         // just making sure it's not a special piece
        {
            JSFSwipeManager.swipeColor = gp.slotNum;
            return(true);
        }
        return(false);
    }
示例#19
0
 // reset the board when no more moves
 public void reset(JSFPieceDefinition pd, int skinNum)
 {
     if (panel.isFillable())         // if the panel can hold a game piece
     {
         if (isFilled)
         {
             piece.resetMe(pd, skinNum); // reset it
         }
         else                            // game piece was stolen by another board and the reference is wrong. create a new piece
         {
             piece = new JSFGamePiece(pd, this, skinNum, position);
             piece.init();
         }
         isFalling = false;
         isActive  = true;
     }
 }
示例#20
0
    // allows you to specify a power merge...
    public virtual bool powerMerge(List <JSFBoard> chain, JSFGamePiece target,
                                   JSFGamePiece refPiece, int[] arrayRef, bool isACheck)
    {
        return(false);

        /* NOTES :-
         * List<JSFBoard> chain <--- the current swipe chain
         * arrayRef <--- the current board position the call is being executed
         * target <--- the current GamePiece being checked for powerMerge
         * refPiece <--- the GamePiece used as a reference (the piece that owns this PieceDefinition
         * isACheck <--- signifies whether this call is a check or an execute call
         *
         * return statements :-
         * return true; <--- tell JSF that there is a powerMerge
         * return false; <--- tell JSF NO powerMerge happened...
         *
         */
    }
示例#21
0
    // power merge ability code
    IEnumerator doPowerMergeFiveVH(int[] arrayRef, JSFGamePiece target, JSFGamePiece refPiece, float delay, int slotNum)
    {
        if (gm.audioScript.specialMatchSoundFx.Length > 0)
        {
            gm.audioScript.specialMatchSoundFx[Random.Range(0, gm.audioScript.specialMatchSoundFx.Length - 1)].play(); // play this sound fx
        }
        List <JSFGamePiece> toBeDestroyed = new List <JSFGamePiece>();                                                 // list of pieces to be destroyed

        gm.destroyInTimeMarked(refPiece.master, delay, scorePerPiece);                                                 // locks this piece & destroys after x seconds
        gm.destroyInTimeMarked(target.master, delay, scorePerPiece);                                                   // locks this piece & destroys after x seconds

        foreach (JSFBoard board in gm.board)
        {
            if (board.isFilled && board.pd is JSFNormalPiece && board.piece.slotNum == slotNum)
            {
                if (Random.Range(0, 2) == 0)               // convert the piece to this type (either vertical or horizontal)
                {
                    board.piece.specialMe(gm.pieceManager.GetComponent <JSFHorizontalPiece>());
                }
                else
                {
                    board.piece.specialMe(gm.pieceManager.GetComponent <JSFVerticalPiece>());
                }
                gm.animScript.doAnim(JSFanimType.CONVERTSPEC, board.arrayRef);
                toBeDestroyed.Add(board.piece);
            }
        }

        yield return(new WaitForSeconds(delay));

        int index;                                                                             // variable to be used

        while (toBeDestroyed.Count > 0)                                                        // if there are still converted boards in the list...
        {
            index = Random.Range(0, toBeDestroyed.Count);                                      // randomly pick a board from the list
            if (toBeDestroyed[index] != null && (toBeDestroyed[index].pd is JSFHorizontalPiece ||
                                                 toBeDestroyed[index].pd is JSFVerticalPiece)) // if it's the correct piece...
            {
                toBeDestroyed[index].master.destroyBox();                                      // destroys the piece that was previously converted
                yield return(new WaitForSeconds(Random.Range(0.5f, 1.5f)));
            }
            toBeDestroyed.RemoveAt(index);             // remove from the list after processed...
        }
    }
示例#22
0
    // function called when user continues swiping (the next pieces being swiped other than the first)
    public virtual bool addToSwipeChain(JSFGamePiece gp, int swipeColor, bool isBoardCheck)
    {
        // isBoardCheck == true if the board is checking for legal swipes (use it in if-else when needed!)
        // return true to allow SwipeManager to add this piece to the swipe chain
        // return false to NOT allow SwipeManager to add this piece to the swipe chain
        // P.S.> this status (true/false) is IGNORED if JSFSwipeManager.allowAnyColorOnce() is active
        //          and this piece is not a special (isSpecial == false)!

        // below is the default behaviour
        // if it's not a special... if swiped is same color, add to swipe
        if (!isSpecial)
        {
            if (gp.slotNum == swipeColor)    // same color...
            {
                return(true);                // allow add to chain
            }
        }
        return(false);        // DO NOT allow add to chain
    }
示例#23
0
    // only used these functions...
    // view more ovveridable functions in PieceDefinition.cs script itself OR
    // check out aPieceTemplate.cs script

    public override bool powerMerge(List <JSFBoard> chain, JSFGamePiece target,
                                    JSFGamePiece refPiece, int[] arrayRef, bool isACheck)
    {
        if (target.pd is JSFNormalPiece && (JSFSwipeManager.lastSwipeChainBoard == target.master ||
                                            JSFSwipeManager.lastSwipeChainBoard == refPiece.master)) // ensure we are only looking at the last swiped
        {
            JSFSwipeManager.swipeColor = target.slotNum;
            if (!isACheck)
            {
                StartCoroutine(specialFiveColored(arrayRef, target, refPiece, target.slotNum, 2f, true)); // do a power merge power
            }
            return(true);                                                                                 // <--- has power merge
        }
        if (target.pd is JSFVerticalPiece || target.pd is JSFHorizontalPiece)
        {
            if (!isACheck)
            {
                StartCoroutine(doPowerMergeFiveVH(arrayRef, target, refPiece, 1.5f, target.slotNum)); // do a power merge power
            }
            JSFSwipeManager.stopFurtherSwipes();                                                      // do not allow further swipes
            return(true);                                                                             // <--- has power merge
        }
        if (target.pd is JSFBombPiece)
        {
            if (!isACheck)
            {
                StartCoroutine(doPowerMergeFiveX(arrayRef, target, refPiece, target.slotNum)); // do a power merge power
            }
            JSFSwipeManager.stopFurtherSwipes();                                               // do not allow further swipes
            return(true);                                                                      // <--- has power merge
        }
        if (target.pd is JSFSpecialFive)
        {
            if (!isACheck)
            {
                doPowerMergeFiveFive(arrayRef, target, refPiece); // do a power merge power
            }
            JSFSwipeManager.stopFurtherSwipes();                  // do not allow further swipes
            return(true);                                         // <--- has power merge
        }
        return(false);                                            // <--- no power merge
    }
示例#24
0
    // power merge ability code
    IEnumerator doPowerMergeXX(int[] arrayRef, int radius, JSFGamePiece target, JSFGamePiece refPiece)
    {
        gm.destroyInTimeMarked(target.master, 2.1f, scorePerPiece);
        gm.destroyInTimeMarked(refPiece.master, 2.1f, scorePerPiece);

        // visual effect for a time bomb
        Vector3 newSize = Vector3.Scale(refPiece.thisPiece.transform.localScale, new Vector3(1.45f, 1.45f, 1f));

        LeanTween.scale(target.thisPiece, newSize, 0.5f).setLoopPingPong();
        LeanTween.scale(refPiece.thisPiece, newSize, 0.5f).setLoopPingPong();
        target.thisPiece.GetComponent <JSFPieceTracker>().enabled   = false;
        refPiece.thisPiece.GetComponent <JSFPieceTracker>().enabled = false;

        doPowerMergeX(target.master.arrayRef, radius, target, refPiece); // blast with arrows flying!
        doBombPower(refPiece.master.arrayRef, radius);                   // normal big blast w/0 arrows

        yield return(new WaitForSeconds(2f));

        doBombPower(target.master.arrayRef, 1);        // normal blast
        doBombPower(refPiece.master.arrayRef, 1);      // normal blast
    }
示例#25
0
    /// <summary>
    /// Does the power merge colored. match 5 type power ( destroys specified param color )
    /// </summary>
    /// <param name="arrayRef">Array reference.</param>
    /// <param name="slotNum">Slot number.(aka piece color)</param>
    /// <param name="delay">Delay for the specialFive trigger</param>
    /// <param name="visuals">If set to <c>true</c> show visuals.</param>
    IEnumerator specialFiveColored(int[] arrayRef, JSFGamePiece target,
                                   JSFGamePiece refPiece, int slotNum, float delay, bool visuals)
    {
        if (visuals)         // if play visual and sound effect
        {
            if (gm.audioScript.matchFiveSoundFx.Length > 0)
            {
                gm.audioScript.matchFiveSoundFx[Random.Range(0, gm.audioScript.matchFiveSoundFx.Length - 1)].play(); // play this sound fx
            }
            gm.animScript.doAnim(JSFanimType.Special5, refPiece.master.arrayRef);                                    // visual fx animation
        }
        gm.destroyInTimeMarked(refPiece.master.arrayRef, delay, scorePerPiece);                                      // locks this piece & destroys after x seconds
        float delayPerPiece = 0.01f;

        yield return(new WaitForSeconds(delay));

        foreach (JSFBoard board in gm.board)         // destroys the selected color in each board
        {
            if (board.isFilled && board.pd is JSFNormalPiece && board.piece.slotNum == slotNum)
            {
                gm.destroyInTime(board, delayPerPiece, scorePerPiece);
            }
        }
    }
示例#26
0
    // only used these functions...
    // view more ovveridable functions in PieceDefinition.cs script itself OR
    // check out aPieceTemplate.cs script

    public override bool addToSwipeChain(JSFGamePiece gp, int swipeColor, bool isBoardCheck)
    {
        return(true);        // can be added to any chain
    }
示例#27
0
 public override void onSwipeAdded(JSFGamePiece gp, bool isBoardCheck)
 {
     JSFSwipeManager.allowAnyColorOnce();         // this is the rainbow piece after all!
 }
示例#28
0
    // power merge ability code
    void doPowerMergeX(int[] arrayRef, int radius, JSFGamePiece target, JSFGamePiece refPiece)
    {
        gm.destroyInTimeMarked(target.master, 0f, scorePerPiece);
        gm.destroyInTimeMarked(refPiece.master, 0f, scorePerPiece);
        doBombPower(arrayRef, radius);        // do bomb power with specified radius

        // arrow power...
        float delay           = 0f;         // the delay variable we are using...
        float delayIncreament = 0.1f;       // the delay of each piece being destroyed.

        gm.audioScript.arrowSoundFx.play(); // play arrow sound fx
        bool destroyThis = false;           // variable to help skip the first board in the list

        // the top of this board...
        foreach (JSFBoard _board in gm.iBoard(arrayRef).getAllBoardInDirection(JSFBoardDirection.Top))
        {
            if (destroyThis)
            {
                gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
            }
            destroyThis = true;
            delay      += delayIncreament;
        }
        delay       = 0f;    // reset the delay
        destroyThis = false; // help to skip the first board in the list...
        // the bottom of this board...
        foreach (JSFBoard _board in gm.iBoard(arrayRef).getAllBoardInDirection(JSFBoardDirection.Bottom))
        {
            if (destroyThis)
            {
                gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
            }
            destroyThis = true;
            delay      += delayIncreament;
        }

        switch (gm.boardType)
        {
        case JSFBoardType.Hexagon:
            gm.animScript.doAnim(JSFanimType.ARROWTLBR, arrayRef[0], arrayRef[1]); // perform anim
            gm.animScript.doAnim(JSFanimType.ARROWTRBL, arrayRef[0], arrayRef[1]); // perform anim
            delay       = 0f;                                                      // reset the delay
            destroyThis = false;                                                   // help to skip the first board in the list...
            // the TopLeft of this board...
            foreach (JSFBoard _board in gm.iBoard(arrayRef).getAllBoardInDirection(JSFBoardDirection.TopLeft))
            {
                if (destroyThis)
                {
                    gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                }
                destroyThis = true;
                delay      += delayIncreament;
            }
            delay       = 0f;       // reset the delay
            destroyThis = false;    // help to skip the first board in the list...
            // the TopRight of this board...
            foreach (JSFBoard _board in gm.iBoard(arrayRef).getAllBoardInDirection(JSFBoardDirection.TopRight))
            {
                if (destroyThis)
                {
                    gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                }
                destroyThis = true;
                delay      += delayIncreament;
            }
            delay       = 0f;       // reset the delay
            destroyThis = false;    // help to skip the first board in the list...
            // the BottomLeft of this board...
            foreach (JSFBoard _board in gm.iBoard(arrayRef).getAllBoardInDirection(JSFBoardDirection.BottomLeft))
            {
                if (destroyThis)
                {
                    gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                }
                destroyThis = true;
                delay      += delayIncreament;
            }
            delay       = 0f;       // reset the delay
            destroyThis = false;    // help to skip the first board in the list...
            // the BottomRight of this board...
            foreach (JSFBoard _board in gm.iBoard(arrayRef).getAllBoardInDirection(JSFBoardDirection.BottomRight))
            {
                if (destroyThis)
                {
                    gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                }
                destroyThis = true;
                delay      += delayIncreament;
            }
            break;

        case JSFBoardType.Square:
            gm.animScript.doAnim(JSFanimType.ARROWVH, arrayRef[0], arrayRef[1]); // perform anim
            delay       = 0f;                                                    // reset the delay
            destroyThis = false;                                                 // help to skip the first board in the list...
            // the Left of this board...
            foreach (JSFBoard _board in gm.iBoard(arrayRef).getAllBoardInDirection(JSFBoardDirection.Left))
            {
                if (destroyThis)
                {
                    gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                }
                destroyThis = true;
                delay      += delayIncreament;
            }
            delay       = 0f;       // reset the delay
            destroyThis = false;    // help to skip the first board in the list...
            // the Right of this board...
            foreach (JSFBoard _board in gm.iBoard(arrayRef).getAllBoardInDirection(JSFBoardDirection.Right))
            {
                if (destroyThis)
                {
                    gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                }
                destroyThis = true;
                delay      += delayIncreament;
            }
            if (gm.iBoard(arrayRef).top != null)
            {
                gm.animScript.doAnim(JSFanimType.ARROWH, gm.iBoard(arrayRef).top.arrayRef); // perform anim
                delay       = 0f;                                                           // reset the delay
                destroyThis = false;                                                        // help to skip the first board in the list...
                // up+1 & left
                foreach (JSFBoard _board in gm.iBoard(arrayRef).top.getAllBoardInDirection(JSFBoardDirection.Left))
                {
                    if (destroyThis)
                    {
                        gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                    }
                    destroyThis = true;
                    delay      += delayIncreament;
                }
                delay       = 0f;           // reset the delay
                destroyThis = false;        // help to skip the first board in the list...
                // up+1 & right
                foreach (JSFBoard _board in gm.iBoard(arrayRef).top.getAllBoardInDirection(JSFBoardDirection.Right))
                {
                    if (destroyThis)
                    {
                        gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                    }
                    destroyThis = true;
                    delay      += delayIncreament;
                }
            }

            if (gm.iBoard(arrayRef).bottom != null)
            {
                gm.animScript.doAnim(JSFanimType.ARROWH, gm.iBoard(arrayRef).bottom.arrayRef); // perform anim
                delay       = 0f;                                                              // reset the delay
                destroyThis = false;                                                           // help to skip the first board in the list...
                // down+1 & left
                foreach (JSFBoard _board in gm.iBoard(arrayRef).bottom.getAllBoardInDirection(JSFBoardDirection.Left))
                {
                    if (destroyThis)
                    {
                        gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                    }
                    destroyThis = true;
                    delay      += delayIncreament;
                }
                delay       = 0f;           // reset the delay
                destroyThis = false;        // help to skip the first board in the list...
                // down+1 & right
                foreach (JSFBoard _board in gm.iBoard(arrayRef).bottom.getAllBoardInDirection(JSFBoardDirection.Right))
                {
                    if (destroyThis)
                    {
                        gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                    }
                    destroyThis = true;
                    delay      += delayIncreament;
                }
            }

            if (gm.iBoard(arrayRef).left != null)
            {
                gm.animScript.doAnim(JSFanimType.ARROWV, gm.iBoard(arrayRef).left.arrayRef); // perform anim
                delay       = 0f;                                                            // reset the delay
                destroyThis = false;                                                         // help to skip the first board in the list...
                // left+1 & up
                foreach (JSFBoard _board in gm.iBoard(arrayRef).left.getAllBoardInDirection(JSFBoardDirection.Top))
                {
                    if (destroyThis)
                    {
                        gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                    }
                    destroyThis = true;
                    delay      += delayIncreament;
                }
                delay       = 0f;           // reset the delay
                destroyThis = false;        // help to skip the first board in the list...
                // left+1 & down
                foreach (JSFBoard _board in gm.iBoard(arrayRef).left.getAllBoardInDirection(JSFBoardDirection.Bottom))
                {
                    if (destroyThis)
                    {
                        gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                    }
                    destroyThis = true;
                    delay      += delayIncreament;
                }
            }

            if (gm.iBoard(arrayRef).right != null)
            {
                gm.animScript.doAnim(JSFanimType.ARROWV, gm.iBoard(arrayRef).right.arrayRef); // perform anim
                delay       = 0f;                                                             // reset the delay
                destroyThis = false;                                                          // help to skip the first board in the list...
                // right+1 & up
                foreach (JSFBoard _board in gm.iBoard(arrayRef).right.getAllBoardInDirection(JSFBoardDirection.Top))
                {
                    if (destroyThis)
                    {
                        gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                    }
                    destroyThis = true;
                    delay      += delayIncreament;
                }
                delay       = 0f;           // reset the delay
                destroyThis = false;        // help to skip the first board in the list...
                // right+1 & down
                foreach (JSFBoard _board in gm.iBoard(arrayRef).right.getAllBoardInDirection(JSFBoardDirection.Bottom))
                {
                    if (destroyThis)
                    {
                        gm.destroyInTime(_board.arrayRef, delay, scorePerPiece);
                    }
                    destroyThis = true;
                    delay      += delayIncreament;
                }
            }

            break;
        }
    }
示例#29
0
 // called by JSFRelay during onPieceClicked
 public virtual void onPieceClicked(JSFGamePiece gp)
 {
     OnPointerClick(gp);
 }
示例#30
0
 // called by GamePiece during destruction of a type
 public virtual void onPieceDestroyed(JSFGamePiece gp)
 {
     // do nothing...
 }