/// <summary> /// Checks if we can cast the spell and starts the cast procedure. /// </summary> public void StartCast() { if (!gamestate.GetCastBar().IsCasting() && !gamestate.GetGcdBar().GetIsInGcd() && !onCooldown) { //we are not casting, are not in an gcd (Global Cooldown) and the spell is not on cooldown target = gamestate.GetTarget(); if (target != null && target.IsAlive()) { if (manaCost >= 0) //spell costs Mana { if (gamestate.DecreaseMana(manaCost)) { //we have enough Mana to cast the spell if (castTime == 0) { CastInstant(); //spell with no casttime } else { StartCoroutine(Cast()); //spell with casttime } } } else //spel regenerates Mana { gamestate.IncreaseMana(manaCost * -1); if (castTime == 0) { CastInstant(); //spell with no casttime } else { StartCoroutine(Cast()); //spell with casttime } } } } }