예제 #1
0
    private void AttemptToPlaceDefenderAt(Vector2 gridPos)
    {
        var DcoinDisplay = FindObjectOfType <DcoinDisplay>();
        int defenderCost = defender.GetDcoinCost();

        if (DcoinDisplay.HaveEnoughDcoins(defenderCost))
        {
            SpawnDefender(gridPos);
            DcoinDisplay.SpendDcoins(defenderCost);
        }
    }
예제 #2
0
    private void LabelButtonWithCost()
    {
        Text costText = GetComponentInChildren <Text>();

        if (!costText)
        {
            Debug.LogError(name + " has no cost text, add a cost text!");
        }
        else
        {
            costText.text = DefenderPrefab.GetDcoinCost().ToString();
        }
    }