Timeline for Adding a time-delay without changing the function signature
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 4, 2020 at 10:38 | vote | accept | Erel Segal-Halevi | ||
| Feb 4, 2020 at 10:14 | answer | added | troien | timeline score: 1 | |
| Feb 4, 2020 at 10:01 | comment | added | Erel Segal-Halevi | @troien I use this BFS in a grid world, and I want to find a path from grid location X to grid location Y. during the execution of the algorithm, I want to put a certain color on the grid locations that the algorithm looks at, so that the player sees how the algorithm works (for educational purposes). If I just run this without any delay, it runs very fast, and all grid locations are colored almost immediately. So I want to add a delay so that the progression of the algorithm is seen more clearly. So yes, I want FindPath to wait for OnNewNodeDiscovered to finish. | |
| Feb 4, 2020 at 10:01 | comment | added | troien | To add a question based on your other comment on the answer, do you instead want FindPath to wait for OnNewNodeDiscovered to finish before continuing finding other nodes? | |
| Feb 4, 2020 at 9:58 | comment | added | troien | To me it's unclear what you are trying to achieve here. Why do you want to have a delay inside OnNewNodeDiscovered? What progress of the algorithm are you trying to display? (do you want to run FindPath and have all nodes it found do something X seconds after you ran FindPath?) And why would returning an IEnumerator break your design in this example? As answer in the meantime, you could also just start a new coroutine (by calling StartCoroutine(myCoroutine(node)); inside the OnNewNodeDiscovered implementation) which does something after x seconds. | |
| Feb 4, 2020 at 9:28 | answer | added | Natalo77 | timeline score: 0 | |
| Feb 4, 2020 at 9:12 | history | asked | Erel Segal-Halevi | CC BY-SA 4.0 |