Esempio n. 1
0
        public IGameObject BuildGameObject(GameObjectSerialized gameObjectSerialized)
        {
            if (gameObjectSerialized.GameObjectType != SerializedName)
            {
                throw new ArgumentException("Wrong serialized object");
            }

            var enemyInputComponent = new EnemyInputComponent(_gameObjectLocator,
                                                              _geometryMathService, _enemyData);

            var enemyPhysicComponent = new PhysicComponent(_enemyData.Speed);

            var enemyLogicComponent = new EnemyLogicComponent(_gameObjectLocator,
                                                              _fireCommand, _geometryMathService, _enemyData);

            var enemyGraphicComponent = new EnemyGraphicComponent(_consoleWriter,
                                                                  _enemyData.DisplayCharNormalState, _enemyData.DisplayCharDestructionState);

            var enemy = new GameObject(enemyInputComponent,
                                       enemyPhysicComponent, enemyLogicComponent, enemyGraphicComponent);

            enemy.X = gameObjectSerialized.X;
            enemy.Y = gameObjectSerialized.Y;

            enemy.Width  = _enemyData.Width;
            enemy.Height = _enemyData.Height;

            return(enemy);
        }
Esempio n. 2
0
        public IGameObject BuildGameObject(GameObjectSerialized gameObjectSerialized)
        {
            if (gameObjectSerialized.GameObjectType != SerializedName)
            {
                throw new ArgumentException("Wrong serialized object");
            }

            var playerInputComponent  = new PlayerInputComponent();
            var playerPhysicComponent = new PhysicComponent(_playerData.Speed);
            var playerLogicComponent  = new PlayerLogicComponent(_fireCommand, _consoleWriter,
                                                                 _geometryMathService);

            var playerGraphicComponent = new PlayerGraphicComponent(_consoleWriter,
                                                                    _geometryMathService, _playerData);

            var user = new GameObject(playerInputComponent,
                                      playerPhysicComponent, playerLogicComponent, playerGraphicComponent);

            user.X = gameObjectSerialized.X;
            user.Y = gameObjectSerialized.Y;

            user.Width  = _playerData.Width;
            user.Height = _playerData.Height;

            return(user);
        }
Esempio n. 3
0
        public IGameObject BuildGameObject(GameObjectSerialized gameObjectSerialized)
        {
            if (gameObjectSerialized.GameObjectType != SerializedName)
            {
                throw new ArgumentException("Wrong serialized object");
            }

            var stoneGraphicComponent = new CharGraphicComponent(_stoneData.DisplayChar,
                                                                 _consoleWriter);
            var stone = new GameObject(null, null, null, stoneGraphicComponent);

            stone.X      = gameObjectSerialized.X;
            stone.Y      = gameObjectSerialized.Y;
            stone.Width  = gameObjectSerialized.Width;
            stone.Height = gameObjectSerialized.Height;

            return(stone);
        }
        public IGameObject BuildGameObject(GameObjectSerialized gameObjectSerialized)
        {
            if (gameObjectSerialized.GameObjectType != SerializedName)
            {
                throw new ArgumentException("Wrong serialized object");
            }

            var winPlatformLogicComponent = new WinPlatformLogicComponent(_gameObjectLocator,
                                                                          _geometryMathService);

            var winPlatformGraphicComponent = new CharGraphicComponent('w', _consoleWriter);

            var winPlatform = new GameObject(null,
                                             null, winPlatformLogicComponent, winPlatformGraphicComponent);

            winPlatform.X          = gameObjectSerialized.X;
            winPlatform.Y          = gameObjectSerialized.Y;
            winPlatform.Width      = gameObjectSerialized.Width;
            winPlatform.Height     = gameObjectSerialized.Height;
            winPlatform.IsAbstract = true;

            return(winPlatform);
        }