Example #1
0
    public void OnHitBoxEnter(Collider otherCollider)
    {
        Police police = otherCollider.GetComponent <Police> ();

        if (police)
        {
            bool hasActuallyHit = police.Knockback(transform.forward * m_HorizontalKnockback + transform.up * m_VerticalKnockback);

            Vector3 newPosition = m_HitParticles.transform.position;
            newPosition.z = -0.5f;
            m_HitParticles.transform.position = newPosition;
            m_Source.PlayOneShot(m_PunchClips[Random.Range(0, m_PunchClips.Length)]);
            m_HitParticles.Play();


            if (hasActuallyHit && !m_CanHitMultipleEnemies)
            {
                m_HitBox.gameObject.SetActive(false);
            }
        }
    }