void OnTriggerEnter2D(Collider2D thingHit) { if (thingHit.tag == "Outline") { OutlineCollison outline = thingHit.GetComponent <OutlineCollison>(); outline.GainNRJ(NRJGain); } if (thingHit.tag == "Player") { PLLogic player = thingHit.GetComponent <PLLogic>(); player.takeDMG(dmg); Instantiate(enemyExsplosion, enemyBlastPos.position + new Vector3(0, moveIn, -1), enemyBlastPos.rotation); Destroy(gameObject); } }
public void OnTriggerEnter2D(Collider2D collisionInfo) { enemy enemy = collisionInfo.GetComponent <enemy>(); if (collisionInfo.tag == "enemy") { enemy.takeDMG(enemyDmg); Destroy(gameObject); } PLLogic player = collisionInfo.GetComponent <PLLogic>(); if (collisionInfo.tag == "Player") { player.takeDMG(playerDmg); Destroy(gameObject); } if (collisionInfo.tag == "Outline") { OutlineCollison outline = collisionInfo.GetComponent <OutlineCollison>(); outline.GainNRJ(NRJGain); } }