public void ExecuteAbility(string attackName, Player owner)
    {
        //tell ballatack to do something based upon the received attack name.
        AttackDef d = abilityDict[attackName];

        //trigger different ability set based on ability type.
        switch (d.abilityType)
        {
        case 0:     //attack
            print(attackName + " " + owner);
            ba.TriggerAttack(d, owner);
            break;

        case 1:     //heal
            ba.TriggerHeal(d, owner);
            break;

        case 2:     //Revive
            ba.TriggerRevive(d, owner);
            break;

        case 3:     //buff
            ba.TriggerBuff(d, owner);
            break;

        case 4:     //debuff
            ba.TriggerDebuff(d, owner);
            break;
        }
    }
示例#2
0
 private void ResetAll()
 {
     //after the attack has been executed rest all related variables to return play to normal.
     Time.timeScale   = 1;
     currentAttackDef = null;
     damaging         = false;
     AOEDamaging      = false;
     AOECol.radius    = 0.1f;
 }
示例#3
0
    public void TriggerBuff(AttackDef def, Player owner)
    {
        //set current user
        currentAttackDef = def;
        currentAttacker  = owner;

        //calibrate the attacks values.
        CalibrateAttack(def);

        def.TriggerEffect(b);
        TriggerDefaultAnim(1.0f, def);
    }
示例#4
0
    //tells the ball to be damaging for a period. sets the area of effects and other valuable effects.
    public void CalibrateAttack(AttackDef def)
    {
        damaging = true;

        if (def.GetAOE())
        {
            AOEDamaging   = true;
            AOECol.radius = def.GetAOERadius();
        }

        Invoke("ResetAll", def.GetDuration());
    }
示例#5
0
    //trigger various attack types based upon the ability definition.
    public void TriggerAttack(AttackDef def, Player owner)
    {
        print("Attack TRIGGERED");
        //set current user
        currentAttackDef = def;
        currentAttacker  = owner;

        //calibrate the attacks values.
        CalibrateAttack(def);

        //use attack stats received to set off attack and trigger animation.
        def.TriggerEffect(b);
        TriggerDefaultAnim(1.0f, def);
    }
    //establish a dictionary of all attacks possible in the game. This will be called by the attack function based upon the playercards attack strings.
    private void Start()
    {
        ba = FindObjectOfType <BallAttack>();

        abilityTypeDict.Add("Attack", 0);
        abilityTypeDict.Add("Heal", 1);
        abilityTypeDict.Add("Revive", 2);
        abilityTypeDict.Add("Buff", 3);
        abilityTypeDict.Add("Debuff", 4);

        AEFlamestrike flameStrike = new AEFlamestrike();
        AEDragonkick  dragonKick  = new AEDragonkick();

        AttackDef fs = new AttackDef("FlameStrike", GameManager.Instance.AIActions["Attack"], abilityTypeDict["Attack"], 1.2f, 35, 23, true, 15, 1.5f, flameStrike);
        AttackDef dk = new AttackDef("DragonKick", GameManager.Instance.AIActions["Attack"], abilityTypeDict["Attack"], 1.2f, 34, 0, false, 0, 1.5f, dragonKick);

        print(fs + " " + dk);
        //this could potentially be exposed via a public array of these enteries. maybe?
        abilityDict.Add("FlameStrike", fs);
        abilityDict.Add("DragonKick", dk);
    }
示例#7
0
    /// <summary>
    /// the default animation for an attack being a slow, zoom and background dim.
    /// </summary>
    /// <param name="duration">how long should DefaultAnim last?</param>
    public void TriggerDefaultAnim(float duration, AttackDef def)
    {
        print("AnimTriggered");

        //darken the screen to focus the player on the attack.
        StartCoroutine(FadeTo(0.5f, GameManager.Instance.universalAnimationDuration));

        //slow the time down to add to the effect of the attack
        Time.timeScale = 0.2f;

        //manage the ability plate. this will pass vluable info to the player.
        abilityPlaque.color = new Color(1, 1, 1, 1);
        abilityTitle.color  = new Color(0, 0, 0, 1);
        abilityTitle.text   = def.name;

        //pause the ball.
        ballBody.Pause();
        b.PauseBall();
        Invoke("Unpause", GameManager.Instance.universalAnimationDuration);

        Invoke("ResetAllEffects", def.GetDuration());
    }