/// Refill the current funds of the current player to their max funds void RefillFunds() { PlayerFunds funds = IsMyTurn() ? gm.myFunds : gm.enemyFunds; funds.increaseMaxFunds(); funds.refillFunds(); }
// Start is called before the first frame update void Start() { MainData.LoadData(); MainData.placingTraps = true; isPlacingTraps = MainData.placingTraps; gameUIManager = GameObject.FindGameObjectWithTag("UIManager").GetComponent <GameUIManager>(); playerFunds = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerFunds>(); costText.text = (traps[selectedTrap].cost - traps[selectedTrap].modCost * MainData.upgrades[traps[selectedTrap].trapID]).ToString(); lateralHitInfo = new RaycastHit[4]; Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; }
void ChargeUntargeted() { if (status == CardStatus.InHand) { Debug.LogError("Cannot charge a card in hand!", this); return; } SetIsCharged(true); PlayerFunds funds = (template.authorPlayer == gm.localPlayerNum) ? gm.myFunds : gm.enemyFunds; funds.deductFromFunds(template.chargeCost); }
/// Called by PlayCardAction public void AddToCardSlot(CardSlot cardSlot) { // parent to the card slot and move to it this.transform.SetParent(cardSlot.transform); this.transform.DOLocalMove(Vector2.zero, 0.1f); cardSlot.AddCard(this); hand.RemoveFromHand(this); status = CardStatus.OnBoard; PlayerFunds funds = (template.authorPlayer == gm.localPlayerNum) ? gm.myFunds : gm.enemyFunds; funds.deductFromFunds(template.playCost); UpdateTargetingGroupForChargeability(); mouseDraggable.isDraggable = false; // disable dragging sortingLayerManager.SetSortingLayer("CardInCardSlot"); }