コード例 #1
0
    void Start()
    {
        pool = Contexts.sharedInstance.pool;

        pool.GetGroup(PoolMatcher.Audio).OnEntityAdded    += OnAudioAdded;
        pool.GetGroup(PoolMatcher.GameOver).OnEntityAdded += (group, entity, index, component) => StopMusic();
    }
コード例 #2
0
    // 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();
        };
    }
コード例 #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;
    }
コード例 #4
0
    public TurnSystem(Contexts contexts)
        : base(contexts.pool)
    {
        pool = contexts.pool;

        turnBasedEntities = pool.GetGroup(PoolMatcher.TurnBased);
        turnBasedEntities.OnEntityAdded   += OnTurnBasedEntityAdded;
        turnBasedEntities.OnEntityRemoved += OnTurnBasedEntityRemoved;
    }
コード例 #5
0
 public CreateGameBoardSystem(Contexts contexts)
     : base(contexts.pool)
 {
     pool = contexts.pool;
     deleteOnExitGroup = pool.GetGroup(PoolMatcher.DeleteOnExit);
 }
コード例 #6
0
 public ExitSystem(Contexts contexts)
     : base(contexts.pool)
 {
     pool      = contexts.pool;
     exitGroup = pool.GetGroup(PoolMatcher.Exit);
 }
コード例 #7
0
 public CoroutineSystem(Contexts contexts)
 {
     pool            = contexts.pool;
     coroutinesGroup = pool.GetGroup(PoolMatcher.Coroutine);
 }