Closed maccxs closed 4 years ago
At least in the supermarket level i can continue playing the game and even finish it after i pressed q. The exit canvas pops up, but everything else keeps on running in the background. I did not test it for the other level but guess it is the same there.
Maybe resolve this by pausing the game when q is pressed?
I tried with pausing the game, but then if I press "Retry" the game is still paused. Any ideas how to fix that?
In sandbox mode when i press 'c' or 'q' twice then it ends. I restart and it ends after 5 seconds again. Possibly because the input is cached somewhere and this is then read in the next round as a key press. Thus, we should find out how to delete this internal cache and do so before a level starts.
I just made two updates.
It was possible that the ELC triggered the EndGamePlayerExposed and EndGamePlayerAtHome simultaneously. I deactivated this behaviour. Now once one of the ending routines is called, no other can be called. This also fixed the issue in the sandbox mode described in my comment above.
The ELC now has a public variable testMode, which we can set in the scene view. If true, then pressing c will finish the level. If false it does not. This way, we wont have to delete any code to deactivate test mode. We just need to uncheck the box for each endlevelcontroller in the level scene view of the unity editor.
i was too quick there. The problem still exists.
Ok, i know where this comes from. The level gets ended by pressing ´c´ or ´q´ and when we then restart quickly enought, somehow, the DelayedEndLevel routine is running and terminates the new level after a few seconds.
This is particularly weird since the whole elc should be a new instance when the sandbox is restarted... Also i tried to stop the coroutines when exiting but did not succeed.
I am using this as a rubber duck now...
i am getting closer to the cause of this. Somehow, when we restart the sandbox, the elc sometimes registers 0 active infections. And this then triggers the CheckEndCondition and finishes the level.
Ok, i think i have it. It is unrelated to pressing the buttons.
Sometimes the Start()
Routine of HumanBase
is called before the Start()
routine of HumanInstants
.
This is due to the fact, that the order in which the Start()
routines are called is undefined.
When an NPC starts as infected, this is set by SetInitialCondition
in HumanInstants::CreateHumans
which is called during Start
.
This initial infected NPC is only passed on to the EndLevelController in the NPCs Start()
routine at
SetCondition(_initialCondition);
but, if the NPCs Start()
routine was already executed before its InitialCondition
was set by the HumanBase
start, then this Info does not get passed on to the EndLevelController.
And thus, the ELC thinks that there are 0 infected NPCs and hence wants to finish the game.
This also causes the ELC to think that there are less infected humans then actually are.
I think this is unrelated to the q key and opened a new issue.
I think we can merge this as soon as leveldemo is reviewed
If i get infected in demo level and then retry the game is paused
If i get infected in demo level and then retry the game is paused
Solved by improving the PauseGame class.
If i get infected in demo level and then retry the game is paused
Solved by improving the PauseGame class.
Did you already commit this? I have the same problem in the disco level
If i get infected in demo level and then retry the game is paused
Solved by improving the PauseGame class.
This really puzzled me since it got worse after your commit. However, gamePaused was not set to true in your code. Fixed in 70c33e5
Damn, thats embarrassing for me :(
Dont't worry about it.
ter we are through with this we should however discuss our branching and reviewing workflow and the public NPC number stuff.
Yes, sorry that this was so chaotic. We should definitely fix some guidlines which also take into account that merging stuff in unity is a pain.