Beispiel #1
0
    public void OnDrag(PointerEventData eventData)
    {
        transform.position = new Vector2(transform.position.x + eventData.delta.x, transform.position.y + eventData.delta.y);
        if (eventData.pointerEnter && eventData.pointerEnter.name == "RuneSlot")
        {
            RuneSlot rSlot = eventData.pointerEnter.gameObject.GetComponent <RuneSlot>();
            if (rSlot && !rSlot.Locked)
            {
                _newRuneSlot = rSlot;
            }
        }
        else if (eventData.pointerEnter && eventData.pointerEnter.name == "RuneImage")
        {
            RuneElement rRlement = eventData.pointerEnter.GetComponentInParent <RuneElement>();
            RuneSlot    rSlot    = null;
            if (rRlement)
            {
                rSlot = rRlement.GetRuneSlot();
            }

            if (rSlot && !rSlot.Locked)
            {
                _newRuneSlot = rSlot;
            }
        }
        else
        {
            _newRuneSlot = null;
        }
    }
Beispiel #2
0
 public void AddToSlot(RuneElement rune)
 {
     if (RuneElement != null)
     {
         RuneElement.RemoveFromSlot();
     }
     RuneElement = rune;
     _magicMaker.UpdateRunes();
 }
Beispiel #3
0
 public void PutInFirstAvalibleSlot(RuneElement runeElement)
 {
     foreach (var slot in RuneSlots)
     {
         if (slot.RuneElement == null && !slot.Locked)
         {
             runeElement.PutInSlot(slot);
             return;
         }
     }
 }
Beispiel #4
0
 private void UpdateAvalibleRunes()
 {
     foreach (var runeElement in _instancedRunes)
     {
         Destroy(runeElement.gameObject);
     }
     _instancedRunes.Clear();
     foreach (var rune in _myRunes)
     {
         if (rune.Unlocked)
         {
             GameObject go = Instantiate(RunePrefab, AvalibleRunesParent);
             go.SetActive(true);
             RuneElement re = go.GetComponent <RuneElement>();
             re.Init(rune, this);
             _instancedRunes.Add(re);
         }
     }
 }
Beispiel #5
0
 public void RemoveFromSlot()
 {
     RuneElement = null;
     _magicMaker.UpdateRunes();
 }