Last active
February 18, 2020 03:36
-
-
Save qxxxb/3b2d72d385b140b05ccd5788262d2ca1 to your computer and use it in GitHub Desktop.
Reset entities
This file contains 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
using GameProject.ComponentEnums; | |
namespace GameProject.Command | |
{ | |
public class Reset : ICommmand | |
{ | |
Game1 game; | |
public Reset(Game1 game) | |
{ | |
this.game = game; | |
} | |
public void Execute() | |
{ | |
EcRegistry ecRegistry = ServiceLocator.EcRegistry; | |
// This could be encapsulated in a method of `EcRegistry` | |
ecRegistry.data.Clear(); | |
ecRegistry.dataGrouped.Clear(); | |
ecRegistry.nextEntity = 0; | |
game.player.Spawn(); | |
game.item.Spawn(); | |
game.enemy.Spawn(); | |
game.block.Spawn(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment