예제 #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);
 }
예제 #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));
        }
    }
예제 #3
0
 private void DamageTarget()
 {
     target.GetHit(Damage, 0f, Vector3.zero, AttackEffect.DamageSource.Fire);
 }