Exemplo n.º 1
0
        public void SwitchDisplay()
        {
            if (EquipmentDollUIInstance == null &&
                (EquipmentDollUIContainer == null || EquipmentDollUIPrefab == null))
            {
                return;
            }

            if (!_displayed)
            {
                if (EquipmentDollUIInstance != null)
                {
                }
                else
                {
                    EquipmentDollUIInstance =
                        (EquipmentDollUI)Instantiate(EquipmentDollUIPrefab, EquipmentDollUIContainer.transform);
                }
                EquipmentDollUIInstance.Construct(this);
                CurrentActive = this;
                _displayed    = true;
            }
            else
            {
                EquipmentDollUIInstance.Hide();
                //CurrentActive = null;
                _displayed = false;
            }
        }
 private void HandleOnHeroEquipmentChanged(HeroInventory heroInventory)
 {
     if (HeroInventory == heroInventory)
     {
         if (Debugging)
         {
             Debug.Log("Hero changed, Equipment Screen is updating");
         }
     }
     Construct(heroInventory);
 }
        private void Start()
        {
            // If UI is active already -
            HeroInventory = HeroInventory.GetActive();
            if (HeroInventory != null)
            {
                Construct(HeroInventory);
            }

            InventoryItemDisplay.OnClick         += HandleOnClick;
            HeroInventory.OnHeroEquipmentChanged += HandleOnHeroEquipmentChanged;
        }
        public void TryToDisplay()
        {
            if (EquipmentDollUI == null)
            {
                return;
            }

            if (!_displayed)
            {
                EquipmentDollUI.Construct(this);
                CurrentActive = this;
                _displayed    = true;
            }
            else
            {
                EquipmentDollUI.Hide();
                //CurrentActive = null;
                _displayed = false;
            }
        }
        public void Construct(HeroInventory heroInventory)
        {
            HeroInventory = heroInventory;
            gameObject.SetActive(true);

            if (Helmet != null)
            {
                Helmet.Construct(heroInventory.Helmet);
            }
            if (Armor != null)
            {
                Armor.Construct(heroInventory.Armor);
            }
            if (Weapon != null)
            {
                Weapon.Construct(heroInventory.Weapon);
            }
            if (Offhand != null)
            {
                Offhand.Construct(heroInventory.Offhand);
            }
        }