Ejemplo n.º 1
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    //  Called when the object is "clicked on" and the selection wheel appears.
    /// </summary>
    public override void OnSelectionWheel()
    {
        base.OnSelectionWheel();

        // Show building slot wheel
        if (_Player)
        {
            // There ISNT a building on the slot
            if (_BuildingOnSlot == null)
            {
                // Cast object
                List <Abstraction> selectables = new List <Abstraction>();
                foreach (var item in Buildings)
                {
                    selectables.Add(item);
                }

                // Update list on the selection wheel
                _Player._HUD.SelectionWheel.UpdateListWithBuildings(selectables, this);

                // Reset selection wheel highlight
                _Player._HUD.SelectionWheel.DetailedHighlightTitle.text           = "";
                _Player._HUD.SelectionWheel.DetailedHighlightDescriptionLong.text = "";

                // Show selection wheel
                GameManager.Instance.SelectionWheel.SetActive(true);

                // Get selection wheel reference
                SelectionWheel selectionWheel = null;
                if (GameManager.Instance._IsRadialMenu)
                {
                    selectionWheel = GameManager.Instance.SelectionWheel.GetComponentInChildren <SelectionWheel>();
                }
                else
                {
                    selectionWheel = GameManager.Instance.selectionWindow.GetComponentInChildren <SelectionWheel>();
                }
                selectionWheel.SetDefaultAbstraction(this);
                selectionWheel.HideItemPurchaseInfoPanel();

                _IsCurrentlySelected = true;
            }

            // There IS already a building on the slot
            else
            {
                _BuildingOnSlot.OnSelectionWheel();
            }
        }
    }
Ejemplo n.º 2
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    //  Called when the object is "clicked on" and the selection wheel appears.
    /// </summary>
    public override void OnSelectionWheel()
    {
        base.OnSelectionWheel();

        // Show the building's options if its active in the world
        if (_ObjectState == WorldObjectStates.Active)
        {
            // Show building slot wheel
            if (_Player && Selectables.Count > 0)
            {
                // Update list then display on screen
                _Player._HUD.SelectionWheel.UpdateListWithBuildables(Selectables, AttachedBuildingSlot);

                // Get reference to the recycle building option
                if (Selectables[5] != null)
                {
                    _RecycleOption = Selectables[5].GetComponent <RecycleBuilding>();
                }

                // Update radial wheel building queue item counters
                if (_BuildingQueueUI != null)
                {
                    _BuildingQueueUI.UpdateSelectionWheelItemCounters();
                }

                // Show selection wheel
                if (ShowSelectionGUI)
                {
                    GameManager.Instance.SelectionWheel.SetActive(true);
                }

                // Update center panels
                SelectionWheel selectionWheel = null;
                if (GameManager.Instance._IsRadialMenu)
                {
                    selectionWheel = GameManager.Instance.SelectionWheel.GetComponentInChildren <SelectionWheel>();
                }
                else
                {
                    selectionWheel = GameManager.Instance.selectionWindow.GetComponentInChildren <SelectionWheel>();
                }
                selectionWheel.SetDefaultAbstraction(this);
                selectionWheel.HideItemPurchaseInfoPanel();
            }
            _IsCurrentlySelected = true;
        }

        // Show a wheel with recycle only as the selection (so you can cancel building the world object)
        else if (_ObjectState == WorldObjectStates.Building || _ObjectState == WorldObjectStates.InQueue)
        {
            if (_Player)
            {
                List <Abstraction> wheelOptions = new List <Abstraction>();
                for (int i = 0; i < 10; i++)
                {
                    // Recycle option
                    if (i == 5)
                    {
                        if (_RecycleOption == null)
                        {
                            _RecycleOption = ObjectPooling.Spawn(GameManager.Instance.RecycleBuilding).GetComponent <RecycleBuilding>();
                        }
                        _RecycleOption.SetBuildingToRecycle(this);
                        _RecycleOption.SetToBeDestroyed(true);
                        wheelOptions.Add(_RecycleOption);
                    }

                    // Empty option
                    else
                    {
                        wheelOptions.Add(null);
                    }
                }

                // Update list then display on screen
                _Player._HUD.SelectionWheel.UpdateListWithBuildables(wheelOptions, AttachedBuildingSlot);

                // Show selection wheel
                if (ShowSelectionGUI)
                {
                    GameManager.Instance.SelectionWheel.SetActive(true);
                }

                // Update center panels
                SelectionWheel selectionWheel = null;
                if (GameManager.Instance._IsRadialMenu)
                {
                    selectionWheel = GameManager.Instance.SelectionWheel.GetComponentInChildren <SelectionWheel>();
                }
                else
                {
                    selectionWheel = GameManager.Instance.selectionWindow.GetComponentInChildren <SelectionWheel>();
                }
                selectionWheel.SetDefaultAbstraction(this);
                selectionWheel.HideItemPurchaseInfoPanel();
            }
            _IsCurrentlySelected = true;
        }
    }