void OnTriggerEnter(Collider other)
    {
        if (!player.animator.GetCurrentAnimatorStateInfo(0).IsName("swing") && !player.animator.GetCurrentAnimatorStateInfo(0).IsName("1HAttack") && !player.animator.GetCurrentAnimatorStateInfo(0).IsName("2HAttack") || hitCooldown > 0F)
        {
            return;
        }

        if (other.CompareTag("Enemy"))
        {
            Enemy_Class enemy = other.GetComponentInChildren <Enemy_Class>();

            hitCooldown = .5F;

            Debug.Log("Herpty derp I have collided");

            enemy.TakeDamage(player.Damage);
            //enemy.Health -= Player Damage
        }
    }
    //ENENY takes dmg... colider

    void OnTriggerEnter(Collider other)
    {
        if (!player.animator.GetCurrentAnimatorStateInfo(1).IsName("swing") && !player.animator.GetCurrentAnimatorStateInfo(1).IsName("1HAttack") && !player.animator.GetCurrentAnimatorStateInfo(1).IsName("2HAttack") || hitCooldown > 0F)
        {
            return;
        }

        if (other.CompareTag("Enemy"))
        {
            Enemy_Class enemy = other.GetComponentInChildren <Enemy_Class>();

            hitCooldown = .3F;

            hitplayer.HitNow(player.Damage, enemy.transform);
            enemy.TakeDamage(player.Damage);
            //enemy.Health -= Player Damage

            player.OnDealtDamage();
        }
    }
Beispiel #3
0
    private void Update()
    {
        if (progress == -2F)
        {
            progress             = -1F;
            transform.localScale = Vector3.zero;

            Collider[] collided = Physics.OverlapSphere(transform.position, onScale.x / 2);
            foreach (Collider collider in collided)
            {
                if (!collider.CompareTag("Enemy"))
                {
                    continue;
                }

                Enemy_Class enemy = collider.GetComponent <Enemy_Class>();

                if (!enemy)
                {
                    continue;
                }

                enemy.TakeDamage(damageDealt);
            }
        }
        if (progress == -1F)
        {
            return;
        }

        progress            += Time.deltaTime;
        transform.localScale = Vector3.Lerp(offScale, onScale, progress / activationTime);

        if (progress >= activationTime)
        {
            progress = -2F;
        }
    }