Exemplo n.º 1
0
    private void AttemptToPlaceDefenderAt(Vector2 gridPos)
    {
        var mineralDisplay = FindObjectOfType <MineralDisplay>();
        int defenderCost   = defender.GetMineralCost();

        if (mineralDisplay.HaveEnoughMinerals(defenderCost))
        {
            SpawnDefender(gridPos);
            mineralDisplay.SpendMinerals(defenderCost);
        }
    }
Exemplo n.º 2
0
    private void LabelButtonWithCost()
    {
        Text costText = GetComponentInChildren <Text>();

        if (!costText)
        {
            Debug.LogError(name + " has no cost text");
        }
        else
        {
            costText.text = defenderPrefab.GetMineralCost().ToString();
        }
    }