Пример #1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        if (eventData.button != PointerEventData.InputButton.Left)
        {
            return;
        }

        if (player.GetResources() < building.GetPrice())
        {
            animator.SetTrigger("NotEnoughResourcesTrigger");
            return;
        }

        unitSelectionHandler.gameObject.SetActive(false);

        buildingPreviewInstance  = Instantiate(building.GetBuildingPreview());
        buildingRendererInstance = buildingPreviewInstance.GetComponentInChildren <Renderer>();

        buildingPreviewInstance.SetActive(false);

        player.ShowLegalBuildingPlacement();
    }