コード例 #1
0
ファイル: Hero.cs プロジェクト: AtwoodDeng/SimpleBattle
    /// <summary>
    /// Do the attack
    /// </summary>
    /// <returns>The attack.</returns>
    public virtual float BattleAttack()
    {
        Damage[] dmgs = m_attack.GetAllDamage();

        if (m_passive != null)
        {
            m_passive.ChangeDamageOnAttack(ref dmgs);
        }

        GetHeroInfo().Record(dmgs, HistoryStep.RecordType.AfterAttack);

        if (m_heroAnim != null)
        {
            BattleField.ShowBlock(m_attack.GetAttackRange(), BattleBlock.BlockVisualType.BattleAttackRange);
            BattleField.ShowBlock(m_attack.GetTargetBlock(), BattleBlock.BlockVisualType.BattleAttackTarget, false);
            BattleField.ShowBlock(new SimBlock[] { TemSimpleBlock }, BattleBlock.BlockVisualType.BattleThisHero, false);
            // the damage will be sent during the animation
            return(m_heroAnim.Attack(dmgs, m_attack.GetTargetBlock(), m_attack.GetAttackRange()));
        }
        else
        {
            foreach (Damage d in dmgs)
            {
                SendDamage(d);
            }
        }
        return(0);
    }