Exemplo n.º 1
0
        public GameInitialization(Controllers controllers, Data data)
        {
            Camera camera = Camera.main;
            var    inputInitialization  = new InputInitialization();
            var    playerFactory        = new PlayerFactory(data.Player);
            var    playerInitialization = new PlayerInitialization(playerFactory, data.Player.Position);
            var    enemyFactory         = new EnemyFactory(data.Enemy);
            var    enemyInitialization  = new EnemyInitialization(enemyFactory);

            controllers.Add(inputInitialization);
            controllers.Add(playerInitialization);
            controllers.Add(enemyInitialization);
            controllers.Add(new InputController(inputInitialization.GetInput()));
            controllers.Add(new MoveController(inputInitialization.GetInput(), playerInitialization.GetPlayer(), data.Player));
            controllers.Add(new EnemyMoveController(enemyInitialization.GetMoveEnemies(), playerInitialization.GetPlayer()));
            controllers.Add(new CameraController(playerInitialization.GetPlayer(), camera.transform));
            controllers.Add(new EndGameController(enemyInitialization.GetEnemies(), playerInitialization.GetPlayer().gameObject.GetInstanceID()));
        }
Exemplo n.º 2
0
        private void Start()
        {
            Camera camera = Camera.main;
            var    inputInitialization  = new InputInitialization();
            var    playerFactory        = new PlayerFactory(_data.Player);
            var    playerInitialization = new PlayerInitialization(playerFactory);
            var    enemyFactory         = new EnemyFactory(_data.Enemy);
            var    enemyInitialization  = new EnemyInitialization(enemyFactory);

            _controllers = new Controllers();
            _controllers.Add(inputInitialization);
            _controllers.Add(playerInitialization);
            _controllers.Add(enemyInitialization);
            _controllers.Add(new InputController(inputInitialization.GetInput()));
            _controllers.Add(new MoveController(inputInitialization.GetInput(), playerInitialization.GetPlayer(), _data.Player));
            _controllers.Add(new EnemyMoveController(enemyInitialization.GetEnemy(), playerInitialization.GetPlayer()));
            _controllers.Add(new CameraController(playerInitialization.GetPlayer(), camera.transform));
            _controllers.Initialization();
        }