public void OnPointerClick(PointerEventData pointerEventData)
    {
        if (pointerEventData.button == PointerEventData.InputButton.Left)
        {
            GameObject selectedObject = BuildingsManagerBehaviour.SelectedBuilding;

            BuildingsManagerBehaviour.UnselectBuilding();
            MonoBehaviour.Destroy(selectedObject);

            NavMeshSurfacesManager.BuildNavMesh();
        }
    }
    /**
     * <summary>
     * Select a given building
     * </summary>
     *
     * <param name="building"></param>
     *
     * <returns>
     * void
     * </returns>
     */
    public static void SelectBuilding(GameObject building)
    {
        // Unselect previous building
        BuildingsManagerBehaviour.UnselectBuilding();

        // Unselect units
        if (UnitsManagerBehaviour.SelectedUnits != null)
        {
            UnitsManagerBehaviour.UnselectGameObjects();
        }

        // Unselect previous resource
        if (ResourcesManagerBehaviour.SelectedResource != null)
        {
            ResourcesManagerBehaviour.UnselectResource();
        }

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

        buildingBehaviour.SetSelect(true);

        // Show info component panel
        Self.infoComponentPanel.SetActive(true);

        Self.infoComponentPanel
        .transform
        .Find("Single")
        .gameObject
        .SetActive(true);

        BuildingUI buildingUI = buildingBehaviour.GetUI()
                                .GetComponent <BuildingUI>();

        InfoComponentPanelUI infoComponentPanelUI = Self.infoComponentPanel.GetComponent <InfoComponentPanelUI>();

        infoComponentPanelUI.SetName(building.name);
        infoComponentPanelUI.SetHealth(buildingBehaviour.GetHealth(), buildingBehaviour.GetMaxHealth());
        infoComponentPanelUI.SetIcon(buildingUI.GetIcon());

        // Show action component panel
        Self.actionComponentPanel.SetActive(true);

        // Set selected building
        BuildingsManagerBehaviour.SelectedBuilding = building;
    }
    /**
     * <summary>
     * On unit selected
     * </summary>
     */
    public virtual void OnSelected()
    {
        // Stop selection through the UI.
        if (ComponentPanelsUI.OnUI)
        {
            return;
        }

        // Unselect resources
        if (ResourcesManagerBehaviour.SelectedResource != null)
        {
            ResourcesManagerBehaviour.UnselectResource();
        }

        // Unselect building
        if (BuildingsManagerBehaviour.SelectedBuilding != null)
        {
            BuildingsManagerBehaviour.UnselectBuilding();
        }

        this.UI.SetActive(true);
    }
    /**
     * <summary>
     * On left mouse up
     * </summary>
     *
     * <returns>
     * void
     * </returns>
     */
    private void OnLeftMouseUp()
    {
        // Stop scrolling, if the mouse is over UI or in build mode.
        if (!this.drag)
        {
            return;
        }

        // Is pointer up on the component panels UI, stop the selection
        if (ComponentPanelsUI.OnUI)
        {
            this.drag = false;
            this.HideSelectionArea();

            return;
        }

        RectTransform areaRect = this.area.GetComponent <RectTransform>();

        // Set final mouse position
        this.mousePosition.SetFinalPosition(this.transform.position);

        Bounds cameraViewportBounds = MouseScreenBehaviour.GetViewportBounds(
            this.mousePosition.GetInitialPosition(),
            this.mousePosition.GetFinalPosition()
            );

        ResourcesManagerBehaviour.UnselectResource();
        BuildingsManagerBehaviour.UnselectBuilding();

        UnitsManagerBehaviour.UnselectGameObjects();

        this.mouseSelectionBehaviour.SelectGameObjects(UnitsManagerBehaviour.Visibles, cameraViewportBounds);

        this.drag = false;
        this.HideSelectionArea();
    }