Beispiel #1
0
        private void DragModifier_SelectionChanged(DragAndDropModifier obj)
        {
            if (obj == null)
            {
                _bigChoseHint.gameObject.SetActive(true);
                _upgradeName.gameObject.SetActive(false);
                _upgradeDesc.gameObject.SetActive(false);
            }
            else
            {
                _bigChoseHint.gameObject.SetActive(false);
                _upgradeName.gameObject.SetActive(true);
                _upgradeDesc.gameObject.SetActive(true);

                _upgradeName.text = obj.RelatedUpgradePair.WeaponModifier.MyEnumValue.ToString();
                _upgradeDesc.text = obj.RelatedUpgradePair.Description;
            }
        }
        private void DragModifier_ModifierDropped(DragAndDropModifier droppedModifier)
        {
            for (int i = 0; i < _weapons.Length; ++i)
            {
                if (ReferenceEquals(_weapons[i].AttachedModifyer, droppedModifier))
                {
                    _weapons[i].DetachModifier();
                }
            }

            for (int i = 0; i < _weapons.Length; ++i)
            {
                if (_weapons[i].RectTransform.GetHelathyRect().Contains(droppedModifier.RectTransform.position))
                {
                    ApplyModifier(_weapons[i], droppedModifier);
                    return;
                }
            }
            droppedModifier.ResetPosition();
        }
        private void ApplyModifier(WeaponDropTarget weapon, DragAndDropModifier droppedModifier)
        {
            weapon.AttachModifyer(droppedModifier);

            for (int i = 0; i < _weapons.Length; ++i)
            {
                if (_weapons[i].AttachedModifyer == null)
                {
                    return;
                }
            }

            for (int i = 0; i < _modifiers.Length; ++i)
            {
                bool modifierNotUsed = true;

                for (int j = 0; j < _weapons.Length; ++j)
                {
                    if (ReferenceEquals(_modifiers[i].RelatedUpgradePair, _weapons[j].AttachedModifyer.RelatedUpgradePair) == true)
                    {
                        modifierNotUsed = false;
                        break;
                    }
                }

                if (modifierNotUsed)
                {
                    WeaponModifierContainer.Instance.ReturnUnlockedMod(_modifiers[i].RelatedUpgradePair.ModifierID);
                }
            }

            for (int i = 0; i < _weapons.Length; ++i)
            {
                _weapons[i].ApplyModifier();
                _weapons[i].DetachModifier();
            }

            DragAndDropModifier.ResetSelection();
            ModifierApplyed.Invoke();
            TransitionScene.Instance.LoadUnloadScene((int)Scenes.INGAME);
        }
Beispiel #4
0
 public void OnPointerDown(PointerEventData eventData)
 {
     DragAndDropModifier.ResetSelection();
 }