示例#1
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;
            }
        }
    }
示例#2
0
    public void BuildAHouse()
    {
        PlotManager pm = plotManager.GetComponent <PlotManager>();

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

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

            if (bp != null)
            {
                bp.Build(1);
                Builded      = true;
                gold.amount -= (plot as Plot_House).cost;
            }
        }
    }