Example #1
0
    ///<summary>
    /// Called when the command is given (by the player, via the UI/Gridcursor) to cast an ability; Called from the Ability's script.
    /// It handles: either calling ActivateCastingAbility(), or adding the ability to the TurnOrder; as well as moving on with the turn.
    ///</summary>
    public void BeginCastingAbility(Unit unit, LandTile tile, Ability ability)
    {
        unit.unitStats.currentMana -= ability.manaCost;

        CancelRangeIndicator(true);

        if (ability.castTime == 0)
        {
            ActivateCastingAbility(unit, tile, ability);
        }
        else
        {
            Debug.Log("Ability: " + ability.abilityName + " added to the turn list (" + ability.castTime + ").");
            turnManager.AddCombatAction(unit, tile, ability, ability.castTime);
        }
        // Set unit's state to 'casting'; so it's animations etc can be set

        unitHasActed = true;
        CheckTurnStatus();
    }