示例#1
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    //
    /// </summary>
    public void HideWidget()
    {
        _BuildingToRecycle    = null;
        _BuildingSlotInFocus  = null;
        _RecycleBuildingClass = null;
        gameObject.SetActive(false);
    }
示例#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;
        }
    }
示例#3
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    //
    /// </summary>
    /// <param name="cls"></param>
    public void SetRecycleClass(RecycleBuilding cls)
    {
        _RecycleBuildingClass = cls;
    }