Ejemplo n.º 1
0
 public WorldProvider(IGameObjectBuilder gameObjectBuilder,
                      IGeometryMathService geometryMathService, IConsoleWriter consoleWriter)
 {
     _gameObjectBuilder   = gameObjectBuilder;
     _geometryMathService = geometryMathService;
     _consoleWriter       = consoleWriter;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// The methods put the creation of the initial game objects in the correct order.
        /// </summary>
        /// <param name="objectBuilder">Gets a concrete builder, which will provide the needed objects.</param>
        /// <returns>Instance of the game engine.</returns>
        public GameEngine SetupGame(IGameObjectBuilder objectBuilder)
        {
            this.renderer = objectBuilder.CreteRenderer();
            this.player = objectBuilder.CreatePlayer();
            this.scoreboard = objectBuilder.CreateScoreboard();
            this.scoreBoardHandler = objectBuilder.CreteScoreBoardHanler(this.scoreboard);
            this.matrix = objectBuilder.CreateLabyrinthMatrix();

            return GameEngine.Instance(this.player, this.renderer, this.scoreBoardHandler, this.matrix);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The methods put the creation of the initial game objects in the correct order.
        /// </summary>
        /// <param name="objectBuilder">Gets a concrete builder, which will provide the needed objects.</param>
        /// <returns>Instance of the game engine.</returns>
        public GameEngine SetupGame(IGameObjectBuilder objectBuilder)
        {
            this.renderer          = objectBuilder.CreteRenderer();
            this.player            = objectBuilder.CreatePlayer();
            this.scoreboard        = objectBuilder.CreateScoreboard();
            this.scoreBoardHandler = objectBuilder.CreteScoreBoardHanler(this.scoreboard);
            this.matrix            = objectBuilder.CreateLabyrinthMatrix();

            return(GameEngine.Instance(this.player, this.renderer, this.scoreBoardHandler, this.matrix));
        }
Ejemplo n.º 4
0
        public void GetBuilder2()
        {
            var provider   = new FactoryProvider();
            var collection = new FactoryCollection <Type>();
            var factory    = new Factory <string>();

            factory.Add("empty", new GameObjectBuilderEmpty());
            factory.Add("prefab", new GameObjectBuilder(new GameObject("prefab")));
            collection.Add(typeof(IGameObjectBuilder), factory);
            provider.Add(collection);

            IGameObjectBuilder builder1 = provider.GetBuilder <IGameObjectBuilder, Type, string>(typeof(IGameObjectBuilder), "empty");
            IGameObjectBuilder builder2 = provider.GetBuilder <IGameObjectBuilder, Type, string>(typeof(IGameObjectBuilder), "prefab");

            Assert.NotNull(builder1);
            Assert.NotNull(builder2);
        }
Ejemplo n.º 5
0
 public BuilderSpawner(IExpression <Position> positionExpression, IGameObjectBuilder builder)
 {
     PositionExpression = positionExpression;
     Builder            = builder;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates the pool collection with the specified builder and items from the specified collection, and comparer, if presents.
 /// </summary>
 /// <param name="builder">The builder of the items.</param>
 /// <param name="collection">The collection of the items.</param>
 /// <param name="comparer">The equality comparer for items.</param>
 public GameObjectPoolCollection(IGameObjectBuilder <TItem> builder, ICollection <TItem> collection, IEqualityComparer <TItem> comparer = null) : base(builder, collection, comparer)
 {
     Builder = builder;
 }
 /// <summary>
 /// Creates instance of GameObjectBuilder class.
 /// </summary>
 /// <param name="gameObjectBuilder">Can accepts any type of IGameObjectBuilder object.</param>
 public ConsoleColorableGameBuilder(IGameObjectBuilder gameObjectBuilder) : base(gameObjectBuilder)
 {
     this.ChangeConsoleColor();
 }
 /// <summary>
 /// Creates instance of GameObjectBuilder class.
 /// </summary>
 /// <param name="gameObjectBuilder">Can accepts any type of IGameObjectBuilder object.</param>
 public ConsoleSizeableGameBuilder(IGameObjectBuilder gameObjectBuilder)
     : base(gameObjectBuilder)
 {
     this.ChangeConsoleWindowSize();
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates instance of the basic Decorator class.
 /// </summary>
 /// <param name="gameObjectBuilder">Can accepts any type of IGameObjectBuilder object.</param>
 protected Decorator(IGameObjectBuilder gameObjectBuilder)
 {
     this.GameObjectBuilder = gameObjectBuilder;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates instance of GameObjectBuilder class.
 /// </summary>
 /// <param name="gameObjectBuilder">Can accepts any type of IGameObjectBuilder object.</param>
 public ConsoleSizeableGameBuilder(IGameObjectBuilder gameObjectBuilder)
     : base(gameObjectBuilder)
 {
     this.ChangeConsoleWindowSize();
 }
 /// <summary>
 /// Creates instance of GameObjectBuilder class.
 /// </summary>
 /// <param name="gameObjectBuilder">Can accepts any type of IGameObjectBuilder object.</param>
 public ConsoleColorableGameBuilder(IGameObjectBuilder gameObjectBuilder)
     : base(gameObjectBuilder)
 {
     this.ChangeConsoleColor();
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates instance of the basic Decorator class.
 /// </summary>
 /// <param name="gameObjectBuilder">Can accepts any type of IGameObjectBuilder object.</param>
 protected Decorator(IGameObjectBuilder gameObjectBuilder)
 {
     this.GameObjectBuilder = gameObjectBuilder;
 }