Today as I am getting towards the final goal of Phase 1 & 2 work (which is basically me being tested on what I am able to do with regards to coding), I came across my final challenge that I had to deal with before getting towards the Phases (or quiz-like challenges).
But before that, regarding yesterday's issue with the enemy still being able to fire even after the explosion sequence, I was finally able to get it to stop. I was trying to run with an IEnumerator coroutine which had the enemy firing at random intervals of 3–7 seconds under the enemy script. However, I was unfortunately not able to successfully get the stopcouroutine to execute under the private void OnTriggerEnter2D(Collider2D other) method, but that does not seem to work. I think I need to put it under the void update sequence, but I can not think of how to do that with a bool, or perhaps when the removal of the enemy’s BoxCollider happens.
Since I was not able to make it work out in those ways, I had decided to create a firing method for the enemy via a _enemyFireRate, where I had just used a simple formula of (Time.time > _canFire), whereas _canFire is Time + a random range of 3–7 seconds. To which the result is instantiating the _enemyLaserPrefab.
The next issue I worked out was just being able to hit the escape button from a fullscreen game mode, and the result is to exit the game. So under my GameManager script, after doing some searching, to quit the application is as simple as using the input method for the escape key and having the result of Application.Quit();
Too bad all coding wasn’t as simple as my last challenge of getting my game to quit when hitting the escape key lol.
Tomorrow I will finally begin Phase 1.