Exemplo n.º 1
0
        private void Inject()
        {
            // Services
            ImpactService impactService = new ImpactService();

            // Groupal controller
            PortalsController  portalsController = new PortalsController();
            PortalUICollection portalUIList      = new PortalUICollection();

            portalsController.SetPortalRemoveListener(portalUIList);

            // Factories
            PlayerFactory playerFactory = new PlayerFactory(portalsController, portalsController, impactService, portalUIList);
            EnemyFactory  enemyFactory  = new EnemyFactory(impactService);
            PortalFactory portalFactory = new PortalFactory(portalsController, portalUIList);

            // References
            PlayerUI playerUI  = GameObject.Find("/Player").GetComponent <PlayerUI>();
            EnemyUI  enemyUI1  = GameObject.Find("/Enemies/Enemy1").GetComponent <EnemyUI>();
            EnemyUI  enemyUI2  = GameObject.Find("/Enemies/Enemy2").GetComponent <EnemyUI>();
            PortalUI portalUI1 = GameObject.Find("/Portals/Portal1").GetComponent <PortalUI>();
            PortalUI portalUI2 = GameObject.Find("/Portals/Portal2").GetComponent <PortalUI>();
            PortalUI portalUI3 = GameObject.Find("/Portals/Portal3").GetComponent <PortalUI>();

            // Injection
            playerFactory.CreatePlayer(playerUI);
            enemyFactory.CreateEnemy(enemyUI1);
            enemyFactory.CreateEnemy(enemyUI2);
            portalFactory.CreatePortal(portalUI1);
            portalFactory.CreatePortal(portalUI2);
            portalFactory.CreatePortal(portalUI3);
        }
Exemplo n.º 2
0
 public PortalFactory(PortalsController portalsController, PortalUICollection portalUICollection)
 {
     this.portalsController  = portalsController;
     this.portalUICollection = portalUICollection;
     this.portalsController.SetPortalRemoveListener(portalUICollection);
 }