void Start() { pool = Contexts.sharedInstance.pool; pool.GetGroup(PoolMatcher.Audio).OnEntityAdded += OnAudioAdded; pool.GetGroup(PoolMatcher.GameOver).OnEntityAdded += (group, entity, index, component) => StopMusic(); }
// Use awake to ensure that this fires before the systems boot // otherwise it misses the initial level set void Awake() { levelImage = GetComponent <Image>(); pool = Contexts.sharedInstance.pool; pool.GetGroup(PoolMatcher.Level).OnEntityAdded += (group, entity, index, component) => { currentLevel = pool.level.level; pool.isLevelTransitionDelay = true; Invoke("ShowLevelImage", displayDelay); }; pool.GetGroup(PoolMatcher.GameOver).OnEntityAdded += (group, entity, index, component) => { GameOver(); }; }
public GameBoardCacheSystem(Contexts contexts) { pool = contexts.pool; var gameBoard = pool.GetGroup(PoolMatcher.GameBoard); gameBoard.OnEntityAdded += (group, entity, index, component) => CreateNewGameBoardCache((GameBoardComponent)component); gameBoard.OnEntityUpdated += (group, entity, index, previousComponent, newComponent) => CreateNewGameBoardCache((GameBoardComponent)newComponent); var gameBoardElements = pool.GetGroup(Matcher <PoolEntity> .AllOf( PoolMatcher.GameBoardElement, PoolMatcher.Position)); gameBoardElements.OnEntityAdded += OnGameBoardElementAdded; gameBoardElements.OnEntityUpdated += OnGameBoardElementUpdated; gameBoardElements.OnEntityRemoved += OnGameBoardElementRemoved; }
public TurnSystem(Contexts contexts) : base(contexts.pool) { pool = contexts.pool; turnBasedEntities = pool.GetGroup(PoolMatcher.TurnBased); turnBasedEntities.OnEntityAdded += OnTurnBasedEntityAdded; turnBasedEntities.OnEntityRemoved += OnTurnBasedEntityRemoved; }
public CreateGameBoardSystem(Contexts contexts) : base(contexts.pool) { pool = contexts.pool; deleteOnExitGroup = pool.GetGroup(PoolMatcher.DeleteOnExit); }
public ExitSystem(Contexts contexts) : base(contexts.pool) { pool = contexts.pool; exitGroup = pool.GetGroup(PoolMatcher.Exit); }
public CoroutineSystem(Contexts contexts) { pool = contexts.pool; coroutinesGroup = pool.GetGroup(PoolMatcher.Coroutine); }