//Spells public ASpell InstantiateSpell(ref ASpell spell) { ASpell tmp = Instantiate(spell); tmp.Init("PlayerTeam", currentUnit.gameObject); return(tmp); }
public void CancelCast() { if (currentSpell != null) { currentSpell.Cancel(); currentSpellIndex = -1; } currentSpell = null; casting = false; }
private void LaunchSpell() { currentSpell.Launch(); currentSpellBook[currentSpellIndex].spellCooldown = currentSpell.cooldown; UnitPortrait.SpellSlot spellSlot = player.currentUnit.portrait.spellSlots[currentSpellIndex]; spellSlot.mask.gameObject.SetActive(true); spellSlot.coolDown.gameObject.SetActive(true); spellSlot.coolDown.text = currentSpell.cooldown.ToString(); currentSpell = null; casting = false; currentSpellIndex = -1; }
private void StartCasting(int index) { if (currentSpellBook[index].spellCooldown > 0f) { return; } currentSpell = player.InstantiateSpell(ref currentSpellBook[index].spellRef); casting = true; useCursor = currentSpell.useCursor; if (player.useJoyStick) { player.ResetJoystickCursor(); } currentSpellIndex = index; if (currentSpell.castType == ASpell.CastType.QuickCast) { LaunchSpell(); } }