/**
     * <summary>
     * Construct a building
     * </summary>
     *
     * <param name="building">Building gameobject</param>
     *
     * <returns>
     * IEnumerator null
     * </returns>
     */
    private IEnumerator Construct(GameObject building)
    {
        Vector3 closestPoint = this.ClosestPointToBuilding(building);

        this.MoveTo(closestPoint);

        // Move to the closest spot
        // Once the builder has reached the destination, start the construction
        while (!this.IsReachedAtDestination(closestPoint))
        {
            BuildingBehaviour buildingBehaviour = building.GetComponent <BuildingBehaviour>();

            if (buildingBehaviour.IsConstructed())
            {
                this.StopConstruction();
            }

            yield return(null);
        }

        Debug.Log("BUILDER : CONSTRUCTION : START");

        // Starting the construction
        this.constructing = true;

        while (this.constructing)
        {
            this.animation.StartWalkAnimation();

            BuildingBehaviour buildingBehaviour = building.GetComponent <BuildingBehaviour>();
            buildingBehaviour.SetActivate(true);

            this.SetConstructing(!buildingBehaviour.IsConstructed());

            yield return(null);
        }

        Debug.Log("BUILDER : CONSTRUCTION : DONE");

        this.SetStructure(null);

        yield return(null);
    }
    /**
     * <summary>
     * On mouse over
     * </summary>
     *
     * <returns>
     * void
     * </returns>
     */
    private void OnMouseOver()
    {
        if (MouseBehaviour.Mode == MouseMode.Build)
        {
            return;
        }

        // Prevent selectino through the bottom UI
        if (ComponentPanelsUI.OnUI)
        {
            return;
        }

        MouseBehaviour.Mode = MouseMode.OverBuilding;

        // Right clicked
        if (Input.GetMouseButtonDown(1))
        {
            if (this.IsActivated() || UnitsManagerBehaviour.SelectedUnits.Count == 0)
            {
                return;
            }

            GameObject    unit          = UnitsManagerBehaviour.SelectedUnits[0];
            UnitBehaviour unitBehaviour = unit.GetComponent <UnitBehaviour>();
            if (unitBehaviour is BuilderBehaviour)
            {
                ((BuilderBehaviour)unitBehaviour).StartConstruction(this.gameObject);
            }
        }

        // Left clicked
        else if (Input.GetMouseButtonDown(0))
        {
            BuildingBehaviour buildingBehaviour = this.gameObject.GetComponent <BuildingBehaviour>();

            if (buildingBehaviour != null && buildingBehaviour.IsConstructed())
            {
                BuildingsManagerBehaviour.SelectBuilding(this.gameObject);
            }
        }
    }