// function to check if pieces can fall into this board box // ( AKA piece want to come in? Welcome~! ) public override bool allowsGravity(JSFBoardPanel bp) { int listNum = boardA.IndexOf(bp.master); if (listNum >= 0) { int[] arrayRef = getExitPath(boardB[listNum]); if (arrayRef[0] >= 0 && arrayRef[0] < gm.boardWidth && arrayRef[1] >= 0 && arrayRef[1] < gm.boardHeight) // within bounds { if (boardA[listNum].isFilled && !boardB[listNum].isFilled && !boardA[listNum].isFalling) // if there is a piece ready to teleport { boardB[listNum].piece = boardA[listNum].piece; // moves the piece in memory boardB[listNum].piece.master = boardB[listNum]; // sync the master data boardA[listNum].piece = null; // moves the piece visually instantly boardB[listNum].piece.thisPiece.transform.position = boardB[listNum].position; // cancels any tweening still running LeanTween.cancel(boardB[listNum].piece.thisPiece); // mostly its the after-effect drop boardB[listNum].isFalling = false; // reset board status ( as pre-caution ) gm.dropPieces(arrayRef[0], arrayRef[1]); // start the gravity check on the other side } if (gm.countUnfilled(boardB[listNum].arrayRef[0], boardB[listNum].arrayRef[1], true) > 0 && !boardB[listNum].isFilled) { return(true); // still has boxes to fill, allow more in } } } return(false); }
// function to play the audio visuals of this panel public override void playAudioVisuals(JSFBoardPanel bp) { // define your audio visual call here... // e.g. > // master.gm.audioScript.playSound(PlayFx.YOUR DEFINED AUDIO); // master.gm.animScript.doAnim(animType.YOUR DEFINED ANIM, master.arrayRef[0], master.arrayRef[1] ); }
// for external scripts to call, if splash damage hits correct panel type, perform the hit public override bool splashDamage(JSFBoardPanel bp) { // define your panel characteristic... typically durability--; else, do nothing... // don't forget to include "playAudioVisuals(bp);" if needed... return(false); // default behaviour // return statement, // if true - panel skin will refresh and panel will be active for other checks // if false - panel skin will NOT refresh and panel acts as though nothing happened }
// function to check if pieces can fall into this board box public override bool allowsGravity(JSFBoardPanel bp) { int emptyCount = bp.master.gm.countBlockedUnfilled(bp.master.arrayRef[0], bp.master.arrayRef[1], true); if (emptyCount > 0) { return(true); } return(false); }
// for external scripts to call, will indicate that the panel got hit public override bool gotHit(JSFBoardPanel bp) { // your extra/custom code here... base.gotHit(bp); // default behaviour call function ( if needed ) // ====== the default behaviour below - as reference playAudioVisuals(bp); // play audio visual for selected panels bp.durability--; return(true); // tell controller that a hit registered.. ( will swap object skin according to durability ) // ====== end of default behaviour reference // return statement, // if true - panel skin will refresh and panel will be active for other checks // if false - panel skin will NOT refresh and panel acts as though nothing happened }
// for external scripts to call, if splash damage hits correct panel type, perform the hit public override bool splashDamage(JSFBoardPanel bp) { return(false); // do nothing... }
// for external scripts to call, will indicate that the panel got hit public override bool gotHit(JSFBoardPanel bp) { return(false); // do nothing... }
// optional onSkinChange called by BoardPanel when panel changes skin public virtual void onSkinChange(JSFBoardPanel bp) { // do nothing... }
// function to check if this board is a solid panel // ( AKA piece, NO ENTRY!! ROADBLOCK~!- IMPORTANT, not the same of allowsGravity()~! // this function determines if pieces will landslide it's neighbouring piece to fill bottom blocks) public override bool isSolid(JSFBoardPanel bp) { return(false); }
// function to check if this board needs to be filled by gravity public override bool isFillable(JSFBoardPanel bp) { return(false); }
// if the piece here (if any) can be destroyed public override bool isDestructible(JSFBoardPanel bp) { return(true); }
// function to check if pieces can fall into this board box public override bool allowsGravity(JSFBoardPanel bp) { return(false); }
// function to check if pieces can be stolen from this box by gravity // ( AKA piece leaving the box when gravity calls ) public override bool isStealable(JSFBoardPanel bp) { // your logic here ( if needed ) return(true); }
// function to check if pieces can fall into this board box // ( AKA piece want to come in? Welcome~! ) public override bool allowsGravity(JSFBoardPanel bp) { // your logic here ( if needed ) return(false); }
// optional onPanelClicked called by JSFRelay when panel is clicked public override void onPanelClicked(JSFBoardPanel bp) { // default does nothing... }
// optional onSkinChange called by BoardPanel when panel changes skin public override void onSkinChange(JSFBoardPanel bp) { // default does nothing... }
// for external scripts to call, will indicate that the panel got hit public override bool gotHit(JSFBoardPanel bp) { return(false); }
// for external scripts to call, if splash damage hits correct panel type, perform the hit public override bool splashDamage(JSFBoardPanel bp) { return(false); }
// function to check if pieces can re-appear on this board box public override bool allowsAppearReplacement(JSFBoardPanel bp) { // your logic here ( if needed ) return(false); }
// function to play the audio visuals of this panel public override void playAudioVisuals(JSFBoardPanel bp) { // nothing... }
// function to for resetBoard() to know which panel can be resetted public override bool isFillable(JSFBoardPanel bp) { // your logic here ( if needed ) return(false); }
// optional onCreate function to define extra behaviours public override void onPanelCreate(JSFBoardPanel bp) { // add swirl tweening... LeanTween.rotateAround(bp.backPanel, Vector3.back, 359f, 3.0f).setLoopType(LeanTweenType.clamp); }
// function to check if pieces can re-appear on this board box public override bool allowsAppearReplacement(JSFBoardPanel bp) { return(true); }
// optional onDestroy function to define extra behaviours // not the same as being hit... this is when the panel is destroyed completely and changing types public override void onPanelDestroy(JSFBoardPanel bp) { // default does nothing... }
// function to check if pieces can be stolen from this box by gravity public override bool isStealable(JSFBoardPanel bp) { return(true); }
// optional onPlayerMove called by GameManager when player makes the next move public override void onPlayerMove(JSFBoardPanel bp) { // default does nothing... }
// for external scripts to call, if splash damage hits correct panel type, perform the hit public override bool splashDamage(JSFBoardPanel bp) { bp.durability--; playAudioVisuals(bp); return(true); }
// optional onBoardStabilize called by GameManager when board stabilize and gets a suggestion public override void onBoardStabilize(JSFBoardPanel bp) { // default does nothing... }
// function to play the audio visuals of this panel public override void playAudioVisuals(JSFBoardPanel bp) { bp.master.gm.audioScript.lockedPanelHitFx.play(); bp.master.gm.animScript.doAnim(JSFanimType.LOCKHIT, bp.master.arrayRef[0], bp.master.arrayRef[1]); }
// optional onBoardStabilize called by GameManager when board stabilize and gets a suggestion public virtual void onBoardStabilize(JSFBoardPanel bp) { // do nothing... }