private void MakeSpell() { List <SpellEffectInfo> spEfInf = new List <SpellEffectInfo>(); int currentIndex = _indexesOfDamagedSpells[_numOfCreatedSpells]; if (_numOfCreatedSpells + 1 == _indexesOfDamagedSpells.Count) { for (int i = _numOfCreatedSpells; i < _spellInfo.spellEffectInfos.Count; i++) { spEfInf.Add(_spellInfo.spellEffectInfos[i]); //Because now all other effects are sequential } } else { spEfInf.Add(_spellInfo.spellEffectInfos[currentIndex]); } SpellInfo spIn = new SpellInfo( _spellInfo.charSpellsIndex, _spellInfo.isInstant, _spellInfo.dontShowToUser, _spellInfo.needTargetToComeNear, _spellInfo.spellName, _spellInfo.cost, _spell.name, _spellInfo.spellType, _spellInfo.damageType, _spellInfo.spellImpact, spEfInf ); spIn.owner = _spellInfo.owner; SpellCastTransData transData = new SpellCastTransData(); SpellCastHelper_MultiSpell helper_multiCast = gameObject.GetComponent <SpellCastHelper_MultiSpell>(); if (helper_multiCast != null) { transData = helper_multiCast.FindProperCastingPos(spIn.owner, _spellInfo.spellEffectInfos[currentIndex].targetCharacter); } else { transData.position = transform.position; transData.rotationAmount = 0; transData.scale = transform.localScale; } Spell temp = SpellBuilder.Build(spIn, transData); temp.Event_SpellWillDestroy += OnSpellDestroy; _createdSpells.Add(temp); _numOfCreatedSpells++; }
private void OnCharVisualSpellCast(SpellInfo spellInfo) { if (_currentSpell == null) { _currentSpell = SpellBuilder.Build(spellInfo, _charVisual.GetSpellTransData()); _currentSpell.Event_SpellWillDestroy += OnCurrentSpellDestroy; if (Event_SpellCast != null) { Event_SpellCast(_currentSpell); } } else { _currentSpell.HappenedAgain(); } }