예제 #1
0
    //Recibe un edificio y un material y lo instancia en la escena
    public void SetAvailableBuilding(GameObject _building, Material availableMat)
    {
        if (!isBuilt)
        {
            if (availableBuilding != null)
            {
                Destroy(availableBuilding);
            }

            availableBuilding = Instantiate(_building, transform.position, _building.transform.rotation, transform);

            myBuildingType = availableBuilding.transform.GetComponent <BuildingType>();
            myBuildingType.SetManager(nodeManager, this);
            if (myBuildingType.GetBuildingType() == BuildingType.EBuildingType.PIPE)
            {
                myBuildingType.ConnectPipe();
            }


            myBuildingType.ChangeMaterial(availableMat);
        }
    }