private IEnumerator StartSpell(CombatControler control) { Creature.CreatureBase Caster = control.GetComponent <Creature.CreatureBase>(); Creature.CreatureBase Target = Caster?.Target.GetComponent <Creature.CreatureBase>(); if (Sound) { AudioMaster.instace.PlaySound(Sound); } if (Caster.AninControler) { if (AnimationName != string.Empty) { Caster.AninControler.Play(AnimationName); } } switch (type) { case SpellType.Benefyc: Event?.Invoke(new DataEvent { Caster = Caster, Target = Caster, Spell = this }); break; case SpellType.Harm: Event?.Invoke(new DataEvent { Caster = Caster, Target = Target, Spell = this }); break; } yield return(new UnityEngine.WaitForSeconds(Colldown)); IsCasting = false; }
public void Init(CombatControler controler) { IsCasting = true; controler.StartCoroutine(StartSpell(controler)); }