Ejemplo n.º 1
0
    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();
        };
    }
Ejemplo n.º 3
0
    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;
    }
Ejemplo n.º 4
0
    public TurnSystem(Contexts contexts)
        : base(contexts.pool)
    {
        pool = contexts.pool;

        turnBasedEntities = pool.GetGroup(PoolMatcher.TurnBased);
        turnBasedEntities.OnEntityAdded   += OnTurnBasedEntityAdded;
        turnBasedEntities.OnEntityRemoved += OnTurnBasedEntityRemoved;
    }
Ejemplo n.º 5
0
 public CreateGameBoardSystem(Contexts contexts)
     : base(contexts.pool)
 {
     pool = contexts.pool;
     deleteOnExitGroup = pool.GetGroup(PoolMatcher.DeleteOnExit);
 }
Ejemplo n.º 6
0
 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);
 }