// On press void OnPress(bool isPressed) { if (mAlreadyAttack) { Debug.Log("Can't Attack : Already Attack"); return; } if (isPressed) { if (_cost <= mPlayerManager.currentMana) { if (GameManager.getInstance( ).currentPlayerID == this.getOwnerID( )) { mBoardManager.useArrowAt(transform.position); } } else { Debug.Log("Not enough mana"); } } else { ACreature target = mBoardManager.getTarget( ); if (target) { if (target.getOwnerID( ) != this.getOwnerID( ) && target.isOnBoard( )) { attackTarget(target, 0f); } else { Debug.Log("Invalid target " + target.getOwnerID( ) + " " + this.getOwnerID( )); } } mBoardManager.deactiveArrow( ); } }
// On press void OnPress(string id, bool isPressed) { if (!mIsOnBoard || id != ID_CARD) { return; } if (mIsSleeping) { Debug.Log("Can't Attack : I'm Sleeping"); return; } if (mAlreadyAttack) { Debug.Log("Can't Attack : Already Attack"); return; } if (isPressed) { if (GameManager.getInstance( ).currentPlayerID == this.getOwnerID( )) { mBoardManager.useArrowAt(transform.position); } } else { ACreature target = mBoardManager.getTarget( ); if (target) { if (target.getOwnerID( ) != this.getOwnerID( ) && target.isOnBoard( )) { attackTarget(target, 0f); } else { Debug.Log("Invalid target"); } } mBoardManager.deactiveArrow( ); } }