Created
December 26, 2021 04:17
-
-
Save curious-username/3471db7f8f628021bb5c06a223ff30db to your computer and use it in GitHub Desktop.
dodge enemy ontriggerenter2d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnTriggerEnter2D(Collider2D collision) | |
{ | |
if (collision.tag == "Player") | |
{ | |
if (_player != null) | |
{ | |
_player.Damage(); | |
} | |
Explosion(); | |
} | |
if(collision.tag == "Laser") | |
{ | |
_player.AddScore(15); | |
Explosion(); | |
Destroy(collision); | |
} | |
if(collision.tag == "Big_Laser") | |
{ | |
_player.AddScore(15); | |
Explosion(); | |
} | |
if(collision.tag == "Shield") | |
{ | |
Explosion(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment