示例#1
0
    public virtual void Build()
    {
        if (MoneyManager.Money >= cost)
        {
            MoneyManager.Money -= cost;
        }
        else
        {
            cost_label.LowFunds();
            return;
        }

        foreach (MonoBehaviour script in GetComponentsInChildren <MonoBehaviour>())
        {
            script.enabled = true;
        }
        foreach (NavMeshObstacle obst in GetComponentsInChildren <NavMeshObstacle>())
        {
            obst.enabled = true;
        }
        foreach (Renderer rend in GetComponentsInChildren <Renderer>())
        {
            rend.material.color += new Color(0, 0, 0, alphaness);
        }

        Destructible destruct = gameObject.AddComponent <Destructible>();

        destruct.sell_value = sell_value;
        cost_label.gameObject.SetActive(false);
        Destroy(this);
    }
示例#2
0
    private void Build()
    {
        Placeable placeable = obj.GetComponent <Placeable>();

        if (placeable.is_placeable && MoneyManager.Money >= placeable.cost)
        {
            //cost can't be subtracted from money here because it might change with wall type placeables.
            placeable.cost_label = cost_label;
            placeable.Build();
            obj = null;
        }
        else
        {
            cost_label.LowFunds();
        }
    }