BuildingConstruction.startConstruction C# (CSharp) Method

startConstruction() public method

public startConstruction ( GameObject unit ) : void
unit GameObject
return void
    public void startConstruction(GameObject unit)
    {
        updateGrid upG = GetComponent<updateGrid>();

        if(upG != null){
            upG.isBuildingPlaced = true;
        }
        //Change the mesh of the building to the initialMesh
        if(phase==0) GetComponent<MeshFilter>().mesh = initialMesh.GetComponent<MeshFilter>().sharedMesh;

        //Remove the gameObject transparency
        Color color = GetComponent<Renderer>().material.color;
        GetComponent<Renderer>().material.color = new Color(color.r, color.g, color.b, 1);

        //Add the unit
        constructingUnits.Add(unit);

        //Start the construction
        /*if(constructingUnits.Count == 1)
        {
            GetComponent<Unit>().SetInConstruction(true);
        }*/
    }