Esempio n. 1
0
        private void BuildCommands()
        {
            ICommand loadMatchTileGridDataCommand = commandFactory.Build <LoadMatchTileGridDataCommand> ();

            loadMatchTileGridDataCommand.Execute();

            ICommand createMatchTileGridHolderCommand = commandFactory.Build <CreateMatchTileGridHolderCommand> ();

            eventDispatcher.AddListener(ObjectPoolMessage.OBJECT_POOL_COMPLETE, createMatchTileGridHolderCommand.Execute);

            ICommand createMatchTileGridCommand = commandFactory.Build <CreateMatchTileGridCommand> ();

            eventDispatcher.AddListener(MatchTileGridMessage.GRID_HOLDER_CREATED, createMatchTileGridCommand.Execute);

            matchTileTouchedCommand = commandFactory.Build <MatchTileTouchedCommand> ();
            eventDispatcher.AddListener <TouchedObject> (TouchMessage.OBJECT_TOUCHED_2D, MatchTileTouched);

            ICommand removeMatchTileHightLightCommand = commandFactory.Build <RemoveMatchTileHightLightCommand> ();

            eventDispatcher.AddListener(TouchMessage.TOUCH_ENDED, removeMatchTileHightLightCommand.Execute);

            ICommand calculateTilesToRemove = commandFactory.Build <CalculateTilesToRemoveCommand> ();

            eventDispatcher.AddListener(TouchMessage.TOUCH_ENDED, calculateTilesToRemove.Execute);

            ICommand allowFallingTilesCommand = commandFactory.Build <AllowFallingTilesCommand> ();

            eventDispatcher.AddListener(MatchTileGridMessage.ALLOW_FALLING_TILES, allowFallingTilesCommand.Execute);

            ICommand createNewTileCommand = commandFactory.Build <CreateNewTileCommand> ();

            eventDispatcher.AddListener(MatchTileGridMessage.CREATE_NEW_TILE, createNewTileCommand.Execute);

            ICommand checkMovesRemainingCommand = commandFactory.Build <CheckMovesRemainingCommand> ();

            eventDispatcher.AddListener(MatchTileGridMessage.CHECK_MOVES_REMAINING, checkMovesRemainingCommand.Execute);

            ICommand shuffleGridCommand = commandFactory.Build <ShuffleGridCommand> ();

            eventDispatcher.AddListener(MatchTileGridMessage.SHUFFLE_GRID, shuffleGridCommand.Execute);

            hideInvalidTilesCommand = commandFactory.Build <HideInvalidTilesCommand> ();
            eventDispatcher.AddListener <MatchTileType> (MatchTileGridMessage.HIDE_INVALID_TILES, HideInvalidTiles);
            eventDispatcher.AddListener(TouchMessage.TOUCH_ENDED, MatchTileShowTiles);

            removeMatchTilesCommand = commandFactory.Build <RemoveMatchTilesCommand> ();
            eventDispatcher.AddListener <RemoveTile> (MatchTileGridMessage.REMOVE_TILES, RemoveTiles);

            ICommand positionTilesCommand = commandFactory.Build <PositionTilesCommand> ();

            positionTilesCommand.Execute();

            ICommand matchTileHintCommand = commandFactory.Build <MatchTileHintCommand> ();

            matchTileHintCommand.Execute();
        }
Esempio n. 2
0
        public void SetUp()
        {
            matchTileGridModel = Substitute.For <IMatchTileGridModel>();
            eventDispatcher    = Substitute.For <IEventDispatcher> ();

            matchTileTouchedCommand = new MatchTileTouchedCommand();
            matchTileTouchedCommand.matchTileGridModel = matchTileGridModel;
            matchTileTouchedCommand.eventDispatcher    = eventDispatcher;

            GameObject gameObject = new GameObject();

            gameObject.transform.localPosition = Vector3.zero;

            TouchedObject touchedObject = new TouchedObject();

            touchedObject.objectHit = gameObject;

            matchTileTouchedCommand.touchedObject = touchedObject;

            eventDispatcher.CleanAndDestroy();
        }