Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
629 B
1
Indexable
Never
using UnityEngine;

public class HouseController : MonoBehaviour
{
    public HouseView houseView;
    public UpgradeableRepository upgradeableRepository;

    private int currentLevel = 0;

    public void UpgradeHouse()
    {
        UpgradeableData upgradeableData = upgradeableRepository.GetUpgradeableData(currentLevel);

        if (currentLevel < upgradeableData.maxLevel)
        {
            currentLevel++;
            houseView.UpgradeHouseSize(upgradeableData.sizeIncrement);
        }
        else
        {
            Debug.Log("House is already at the maximum level.");
        }
    }
}