Ejemplo n.º 1
0
    private void Attack()
    {
        if (!droneController)
        {
            transform.LookAt(target.transform);
        }
        attackTimer = attackInterval;
        var damage = GameMath.CalculateDamage(enemyController, target);

        if (animator)
        {
            animator.SetInteger("AttackType", Random.Range(0, 3));
            animator.SetTrigger("AttackTrigger");
        }

        if (droneController)
        {
            droneController.FireGuns(target.Transform, attackInterval * 0.9f);
            var random = Random.value;
            if (random >= 0.75)
            {
                droneController.FireMissiles(target.Transform);
            }
            else if (random >= 0.5)
            {
                droneController.FireMortars(target.Transform);
            }
        }

        target.TakeDamage(enemyController, (int)damage);
    }
Ejemplo n.º 2
0
    private void AttackTarget(PlayerController targetPlayer)
    {
        if (!targetPlayer)
        {
            return;
        }

        attackTimer -= Time.deltaTime;
        if (attackTimer <= 0f)
        {
            animations.Attack(() =>
            {
                if (this.Stats.IsDead || !Target || !targetPlayer)
                {
                    Target = null;
                    return;
                }

                var damage = GameMath.CalculateDamage(this, targetPlayer);
                if (targetPlayer.TakeDamage(this, (int)damage))
                {
                    Target = null;
                }
            });

            attackTimer = attackInterval;
        }
    }
Ejemplo n.º 3
0
    private void Attack()
    {
        transform.LookAt(target.transform);

        attackTimer = attackInterval;
        var damage = GameMath.CalculateDamage(enemyController, target);

        animator.SetInteger("AttackType", Random.Range(0, 3));
        animator.SetTrigger("AttackTrigger");

        target.TakeDamage(enemyController, (int)damage);
    }
Ejemplo n.º 4
0
    private void Attack()
    {
        this.transform.LookAt(this.target.transform);

        this.attackTimer = this.attackInterval;
        var damage = GameMath.CalculateDamage(this.enemyController, this.target);

        this.animator.SetInteger("AttackType", UnityEngine.Random.Range(0, 3));
        this.animator.SetTrigger("AttackTrigger");

        this.target.DoDamage(this.enemyController, (int)damage);
    }
Ejemplo n.º 5
0
    private int CalculateDamage(Attributes a, Attributes b)
    {
        var aAttack      = a.Attack;
        var aStrength    = a.Strength;
        var aWeaponPower = 0;
        var aWeaponAim   = 0;
        var aCombatStyle = 0;

        var bStrength    = b.Strength;
        var bDefense     = b.Defense;
        var bArmorPower  = 0;
        var bCombatStyle = 0;

        return((int)GameMath.CalculateDamage(
                   aAttack, aStrength, aCombatStyle, aWeaponPower, aWeaponAim,
                   bStrength, bDefense, bCombatStyle, bArmorPower, false, true));
    }
Ejemplo n.º 6
0
    private void Attack()
    {
        if (destroyed)
        {
            return;
        }

        attackTimer = attackInterval;
        var damage = GameMath.CalculateDamage(enemyController, target);

        if (animator)
        {
            animator.SetInteger("AttackType", UnityEngine.Random.Range(0, 3));
            animator.SetTrigger("AttackTrigger");
        }

        target.TakeDamage(enemyController, (int)damage);
    }
Ejemplo n.º 7
0
 private int GetDamage(IAttackable enemy)
 {
     return((int)GameMath.CalculateDamage(this, enemy));
 }