So, remember how I was talking about putting a Clear() function in Space? Well, I decided to actually do that, since extensions just weren't cutting it for me. Here's a copy of Space.cs, in case you feel like using it. I marked all the spots I changed with // AGV. I also modified ISpace.cs to have a method stub for Clear().
The reason I use while(objectList.Count > 0) instead of foreach in Clear() is because objects get removed from the list in Remove() (and any recursive calls thereof), thereby invalidating enumerators and crashing. This works just as good.
space.Clear()
-
- Posts: 172
- Joined: Sat Sep 24, 2011 7:31 am
Re: space.Clear()
Clearing space would be helpful in getting rid of all that nasty debris and asteroids, but we'd also lose the planets and stars!!!
Please don't end all of existence mister
Please don't end all of existence mister
It's simple, just take the hydraulic phase ship emulator and attach it to the photon particle emitter, BAM, new tower!
-
- Posts: 172
- Joined: Sat Sep 24, 2011 7:31 am
Re: space.Clear()
Don't worry. I won't.Fe_Yoshi wrote:Clearing space would be helpful in getting rid of all that nasty debris and asteroids, but we'd also lose the planets and stars!!!
Please don't end all of existence mister