Exemplo n.º 1
0
        public void SelectSlot(Slot slot)
        {
            if (_currentSlot != null && _currentSlot != slot)
            {
                _currentSlot.Unselect();
            }

            _currentSlot      = (HotBarSlot)slot; // TODO add dedicated event
            _currentSlotIndex = _currentSlot.Index;

            _currentSlot.Select();

            //Select(_currentSlotIndex);
        }
Exemplo n.º 2
0
        public virtual void Choose()
        {
            HotBarSlot slot = Instantiate(gameObject, transform.position, Quaternion.identity, transform).GetComponent <HotBarSlot>();

            slot._object.Remove();
            slot.Store(_object.Reference);

            slot.GetComponent <RectTransform>().FitParent();
            slot.transform.SetParent(canvas.transform);
            slot.transform.SetAsLastSibling();
            slot._isChosen = true;

            if (_object != null)
            {
                slot.Color = _object.Color.SetA(1);
                slot._object.Choose(true);
            }
            else
            {
                slot.Color = _defaultColor.SetA(1);
            }

            slot._targetScale = new Vector3(_chooseScale, _chooseScale, _chooseScale);
        }