Last active
December 31, 2021 15:15
-
-
Save curious-username/caa3e1f777fcbc4c1e1a918b6c3e8fbb to your computer and use it in GitHub Desktop.
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 bool _fireLaser = true; | |
void Update() | |
{ | |
DestroyPowerup(); | |
} | |
private void DestroyPowerup() | |
{ | |
GameObject powerupObj = GameObject.FindGameObjectWithTag("Powerup"); | |
if (powerupObj != null) | |
{ | |
var powerupPosition = powerupObj.transform.position - transform.position; | |
if (powerupPosition.x < 1.0) | |
{ | |
if (_fireLaser) | |
{ | |
Instantiate(_EnemyLaserPrefab, transform.position, Quaternion.identity); | |
_fireLaser = false; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment