コード例 #1
0
    private bool TryAttack(Actor a_target, Color a_flashColor, bool a_isSpell = false)
    {
        if (a_target.IsDead)
        {
            return(false);
        }

        var damage = m_activeActor.TryAttack(a_target);

        if (damage < 0)
        {
            return(false);
        }

        var offset    = IsEnemy(a_target) ? Vector3.left : Vector3.right;
        var targetPos = a_target.ActorSprite.transform.position + offset;

        m_activeActor.ActorSprite.AnimateAttack(targetPos);
        a_target.ActorSprite.Flash(a_flashColor, AttackMoveTime / 2f);

        PlaySoundDelayed(a_isSpell ? m_castSound : m_hitSound, AttackMoveTime / 2f);
        PlaySoundDelayed(a_target.IsDead ? m_deathSound : m_hurtSound, AttackMoveTime / 2f + 0.2f);

        if (a_isSpell == false)
        {
            if (IsEnemy(m_activeActor))
            {
                m_enemyChargePoints += m_chargePointsPerAttack;
            }
            else
            {
                m_playerChargePoints += m_chargePointsPerAttack;
            }
        }

        m_damageText.transform.position = a_target.ActorSprite.transform.position + Vector3.up;
        m_damageText.Text = $"{damage}";
        m_damageText.Show();

        return(true);
    }
コード例 #2
0
ファイル: DuelUIManager.cs プロジェクト: a1069016595/CardGame
 public void ShowFloatText(string mes, FloatTextDele dele)
 {
     floatText.Show(mes, dele);
 }