Skip to content

Commit

Permalink
Use thinker singleton approach
Browse files Browse the repository at this point in the history
  • Loading branch information
wallabra committed Aug 31, 2024
1 parent 774d739 commit 4313d2a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wadsrc/static/zscript/actors/shared/randomspawner.zs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Random spawner tracker singleton ----------------------------------------

class RandomSpawnerTracker {
static RandomSpawnerTracker instance;

class RandomSpawnerTracker : Thinker {
protected int size;
protected Array<Class<Actor> > origin;
protected Array<Class<Actor> > destClass;
protected Array<Actor> dest;

static RandomSpawnerTracker Get() {
RandomSpawnerTracker instance = RandomSpawnerTracker(ThinkerIterator.Create("RandomSpawnerTracker").Next());

if (instance == null) {
instance = new("RandomSpawnerTracker");
instance.Init();
}

return instance;
}

Expand Down

0 comments on commit 4313d2a

Please sign in to comment.