Created
February 23, 2019 20:10
-
-
Save psuong/38d8248e13324df9403dd061797d038f to your computer and use it in GitHub Desktop.
Test SetUp for ECS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ArenaTestFixtures { | |
protected World previousWorld; | |
protected World currentWorld; | |
protected EntityManager entityManager; | |
public RetrievalSystem RetrievalSystem { | |
get => World.Active.GetOrCreateManager<RetrievalSystem>(); | |
} | |
[SetUp] | |
public virtual void SetUp() { | |
previousWorld = World.Active; | |
currentWorld = World.Active = new World("Test World"); | |
entityManager = currentWorld.GetOrCreateManager<EntityManager>(); | |
} | |
[TearDown] | |
public virtual void TearDown() { | |
if (entityManager != null) { | |
currentWorld.Dispose(); | |
currentWorld = null; | |
World.Active = previousWorld; | |
previousWorld = null; | |
entityManager = null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment