Esempio n. 1
0
    protected void UpgradeAHouse(Plot_House plot_house)
    {
        BuildingPoint bp = plot_house.GetComponent <BuildingPoint>();

        if (bp != null)
        {
            bp.Build(bp.currentHouseID + 1);
            Builded      = true;
            gold.amount -= (plot_house as Plot_House).cost;
        }
    }
Esempio n. 2
0
    public void BuildAHouse()
    {
        if (!CanBuild())
        {
            return;
        }
        PlotManager pm = plotManager.GetComponent <PlotManager>();

        BasePlot plot = pm.listPlot.Find((x) => x.plotID == cur_location);

        if (plot is Plot_House)
        {
            Plot_House plot_house = (plot as Plot_House);
            if (plot_house.owner != this && plot_house.owner != null)
            {
                return;
            }
            else if (plot_house.owner == this)
            {
                UpgradeAHouse(plot_house);
                return;
            }

            if (gold.amount < (plot as Plot_House).cost)
            {
                Debug.LogWarning("Not enough money");
                return;
            }
            BuildingPoint bp = plot.GetComponent <BuildingPoint>();

            if (bp != null)
            {
                if (name == "A")
                {
                    bp.Build(1);
                }
                else
                {
                    bp.Build(2);
                }
                (plot as Plot_House).owner = this;
                Builded      = true;
                gold.amount -= (plot as Plot_House).cost;
            }
        }
    }