示例#1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        IDamagable hitHealth = collision.gameObject.GetComponent <IDamagable>();

        if (hitHealth != null)
        {
            if (m_HealthComponent != null)
            {
                hitHealth.Damage(gameObject, m_HealthComponent.CurrentHealth, transform.position, MovementDirection);
                m_HealthComponent.Death(collision.gameObject, m_HealthComponent.MaxHealth, transform.position, -MovementDirection);
            }
        }
    }