public void OnBeginDrag(PointerEventData eventData) { if (GetComponent <Button>().interactable == true) { if (byRegion && CanBeUsed() && spellImage.DummyUnit != null) { regionSpell = Instantiate <RegionSpell>(spellImage.DummyUnit, BattleControll.battleControll.dummyParent); } } }
public void OnEndDrag(PointerEventData eventData) { if (regionSpell != null) { if (byRegion) { if (CanBeUsed()) { if (regionSpell.ApplyRegion(spellImage, spellInBattle)) { regionSpell = null; BattleControll.heroLogic.Energy -= spellImage.EnergyCost; BattleControll.heroLogic.Mana -= spellImage.ManaCost; spellInBattle.GoReload(spellImage.ReloadTurns); } } else { Destroy(regionSpell); } } } }