Ejemplo n.º 1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.GetComponent <HPModule>() == player)
     {
         player.GetHit(Damage, KnockBackForce, transform.position, AttackEffect.DamageSource.Physical);
     }
     Instantiate(hitParticles, transform.position, Quaternion.identity);
     Destroy(gameObject);
 }
Ejemplo n.º 2
0
    private IEnumerator CheckAttack()
    {
        Ray ray = new Ray(transform.position, Player.transform.position - transform.position);

        if (Physics.Raycast(ray, AttackRange, playerLayer))
        {
            yield return(StartCoroutine(AnimateAttack()));

            if (Physics.Raycast(ray, AttackRange, playerLayer))
            {
                Player.GetHit(Damage, KnockBackForce, transform.position, AttackEffect.DamageSource.Physical);
            }

            yield return(new WaitForSeconds(Cooldown));
        }
    }
Ejemplo n.º 3
0
 private void DamageTarget()
 {
     target.GetHit(Damage, 0f, Vector3.zero, AttackEffect.DamageSource.Fire);
 }