private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { LH_Health playerHP = collision.gameObject.GetComponent <LH_Health>(); playerHP.doDamage(mDamage); // Debug.Log("Player damaged"); } }
//Upon colliding the Player, respond by dealing damage to the Player and dying //This functions as a very basic fighting mechanic private void OnTriggerEnter2D(Collider2D collision) { uint damage = (uint)(int)mPlayerDamage; if (collision.tag == "Player") { LH_Health playerHP = collision.gameObject.GetComponent <LH_Health> (); FindObjectOfType <ZG_AudioManager>().playDynamicSound("enemyTakeDamage1"); playerHP.doDamage(damage); Destroy(gameObject); } }