Beispiel #1
0
    public void CastSkill(UnitManager source, UnitManager target, int skill, Tile tile)
    {
        if (source.actionPoints >= apCost[skill - 1])
        {
            switch (skill)
            {
            case 1:
                if (target)
                {
                    Debug.Log("The warrior is doing skill 1");
                    source.PlayTargetAnimation("WarriorSwordAttack");
                    source.AttackTarget(target, apCost[skill - 1], 20);
                    UI.instance.UpdateActionPointsText(source.actionPoints);
                }
                break;

            case 2:
                if (target)
                {
                    Debug.Log("The warrior is doing skill 2");
                    source.PlayTargetAnimation("WarriorBoostDamage");
                    target.BoostDamage(50, apCost[skill - 1]);
                    UI.instance.UpdateActionPointsText(source.actionPoints);
                }
                break;

            case 3:
                if (!target)
                {
                    Debug.Log("The warrior is doing skill 3");
                    source.PlayTargetAnimation("WarriorBoostDamage");
                    source.ChangePosition(tile);

                    source.actionPoints -= apCost[skill - 1];
                    UI.instance.UpdateActionPointsText(source.actionPoints);
                }
                break;
            }
        }
    }