public void OnPlaceableClick(SimpleMapPlaceable mapPlaceable)
    {
        Debug.Log("Placeable clicked: " + mapPlaceable.name);
        if (_routeCreationView && _routeCreationView.VisibleObject.activeSelf)
        {
            CityBuilding cityBuilding = mapPlaceable as CityBuilding;
            if (cityBuilding != null)
            {
                mapPlaceable = cityBuilding.CityPlaceable.MainBuilding;
            }

            _routeCreationView.StationManager.OnTransportStationClick((PathFindingNode)mapPlaceable);
            return;
        }

        ProductProcessorBehaviour productProcessorBehaviour = mapPlaceable.gameObject.GetComponent <ProductProcessorBehaviour>();

        if (productProcessorBehaviour)
        {
            _productProcessorView.ProductProcessorBehaviour = productProcessorBehaviour;
        }
        else if (mapPlaceable is ICityBuilding)
        {
            _cityView.CityBuilding = (ICityBuilding)mapPlaceable;
        }
        else if (mapPlaceable is AbstractStorageContainer)
        {
            _storageContainerView.StorageContainer = (AbstractStorageContainer)mapPlaceable;
        }
    }
示例#2
0
    public void Reset()
    {
        ProductProcessorBehaviour   = null;
        _titleText.text             = "Information";
        _amountLabel.text           = "Select ProductData";
        _productImage.sprite        = _defaultProductSprite;
        _productionTimeSlider.value = 0;

        Debug.Log("Reset FactoryView");
    }
示例#3
0
    void HandleInput()
    {
        // Place selected Object on left click
        if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject())
        {
            _isDragging = true;
        }
        else if (_isDragging && Input.GetMouseButtonUp(0))
        {
            ProductProcessorBehaviour productProcessorBehaviour = _currentPlaceableObject.gameObject.GetComponent <ProductProcessorBehaviour>();
            if (productProcessorBehaviour)
            {
                productProcessorBehaviour.BuildingData = _placementController.PlaceableObjectPrefab;
            }

            DestroyOrPlaceObject();
            OnPlacement();
        }

        // Remove selected Object on right click
        if (!Input.GetMouseButtonDown(1))
        {
            return;
        }

        if (_currentPlaceableObject != null && (_currentPlaceableObject.IsDraggable))
        {
            for (int i = _draggedGameObjects.Count - 1; i >= 0; i--)
            {
                GameObject.Destroy(_draggedGameObjects[i].gameObject);
            }

            _draggedGameObjects.Clear();
        }

        GameObject.Destroy(_currentPlaceableObject.gameObject);
        OnPlacement();
    }